This could be a repeated query and honestly I am a newbie to redirects and proxying in general.
Here is our setup for freeCodeCamp.org:
To be brief, we have three main applications: learn, news and forum.
learn is served from Netlify at the root of the domain and we have other two services which are a ghost and discourse instances respectively behind a NGINX.
Now we are unable to correctly get the true client IP addresses from our NGINX instance, because Netlify reverse proxy on these from its CDN servers. This I understand is expected.
For various reasons we would like to keep the applications at /news and /forum and hence the need for reverse proxy from Netlify.
Here is the
... /forum/* https://forum-proxy.freecodecamp.org/forum/:splat 200 /news https://news-proxy.freecodecamp.org/news/ 200 /news/* https://news-proxy.freecodecamp.org/news/:splat 200 ...
Now we would like to update the
_headers file to send the headers like
X-Forwarded-For and the
X-Real-IP like we used to in our Nginx before moving over to Netlify for the root domain.
Before our move we had yet another NGINX instance that served the static site and forwarded the IP addressed like so the to forum and news NGINX.
# snippet from our previous NGINX config # add client's IP to proxy request to upstream node servers proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr;
We used to be able to intercept these use them in discourse as needed.
Now the question is:
How do we do this using the headers file? Please note that cloudflare is not an issue here because we see Netlify’s CDN IP addresses so, it needs to be forwarded further to the NGINX instance serving these applications.
Thanks for your time and consideration that I am a fairly new to proxying and rewrites.
Did you use the search before posting?
Yes. With not much idea on the current solutions.
What about reading through our Common Issues?
Yes. Verfied that this is not a common issue.