Last active
August 25, 2020 06:38
-
-
Save kzlsakal/27544105d8f5d6215871701c70c5c5af to your computer and use it in GitHub Desktop.
Use redirect instead of proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replace app.use('*/photo/api/*', createProxyMiddleware(photoProxy)); with | |
app.get('/photo/api/*', (req, res, next) => res.redirect(photoTarget + req.originalUrl.replace(/\?.*$/, ''))); | |
// Replace app.use('*/sb/api/*', createProxyMiddleware(sbProxy)); with | |
app.get('/sb/api/*', (req, res, next) => res.redirect(sbTarget + req.originalUrl.replace(/\?.*$/, ''))); | |
// Replace app.use('*/reviews/api/*', createProxyMiddleware(reviewsProxy)); with | |
app.get('/reviews/api/*', (req, res, next) => res.redirect(reviewsTarget + req.originalUrl.replace(/\?.*$/, ''))); | |
// Replace app.use('*/sln/api/*', createProxyMiddleware(slnProxy)); with | |
app.get('/sln/api/*', (req, res, next) => res.redirect(slnTarget + req.originalUrl.replace(/\?.*$/, ''))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the security group settings and ports are not properly set up for your proxy server or one of the services, you may receive a 504 Gateway Timeout or an ECONNREFUSED error in your proxy. You may follow the instructions in this file to use redirection instead of proxy in your server/index.js.