React.js: i have a google login button, that looks something like this
const GoogleButton = () => (
<a href='/auth/google' >
<div className='google-icon-wrapper'>
<img className='google-icon' src= {googleLogo} alt='Google logo'/>
</div>
<p className ='google-btn-text'>
Sign in with google
</p>
</a>
)
React.js (http-proxy-middleware) in development mode i also have proxy settings
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
app.use(proxy("/auth/", { target: "http://localhost:5000/" }));
app.use(proxy("/api/", { target: "http://localhost:5000/" }));
};
Node.js : I have this endpoint, and it doesn't work on production since the proxy does not work on the production
app.get('/auth/google', passport.authenticate('google', {
scope: SCOPE,
access_type: 'offline',
})
);
**when I click on the button, on the production, react sends me to the page - for example: www.example.com/auth/google - but must call node endpoint ** but when i make a fetch request then the node endpoint works, for example, if I do this: fetch ('/api/google'), it will work ..
UPDATE : the problem was in the React serviceWorker.js - PWA ... it cached the result and the link .. i think not sure ..