Trying to set headers for frontend only build
Unanswered
Brown bear posted this in #help-forum
Brown bearOP
We have a build that utilizes a separate backend API (not using Next.js) and need to set headers to handle a web server running on port 80 but needing to hit a load balancer on port 443. Our devops tried to use apache to set these headers using
I tried adding this to
Is this the proper way to set a header for the entire frontend site?
SetEnvIf X-Forwarded-Proto "https" HTTPS=on but has since done away with apache and wants me to find a way to configure x-forwarded-proto through Next.js.I tried adding this to
next.config.js, but I just don't know if this will work, or if it is the correct way to do it:async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'x-forwarded-proto',
value: 'https',
},
],
},
]
}, Is this the proper way to set a header for the entire frontend site?