Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy-Setup #1

Open
rajneeshweb opened this issue Jan 23, 2023 · 0 comments
Open

Proxy-Setup #1

rajneeshweb opened this issue Jan 23, 2023 · 0 comments
Assignees

Comments

@rajneeshweb
Copy link
Collaborator

Proxy is not working while passing Protocol, Host and Port in setupProxy.js file.

`
const { createProxyMiddleware } = require('http-proxy-middleware');

// const env = dotenv.config({ path: '../config.env' })
// const protocol = 'http://'
const protocol = JSON.parse(process.env.HTTPS) ? "https:" : "http:";
const host = process.env.PROXY_HOST
const port = process.env.PROXY_PORT

module.exports = function (app) {

module.exports = function (app) {
try{
app.use(
'/graphql',
createProxyMiddleware({
target: {
protocol: protocol,
host: host,
port: port
},
changeOrigin: true,
})
);
}
catch(err){
console.log(err.message);
}
};
`

@rajneeshweb rajneeshweb self-assigned this Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant