Arthur

Pemberton

Full-stack web applications developer


Backend request heades with an Apache reverse proxy (frontend server)

July 18, 2018Arthur Pemberton0 Comments

If you ever find yourself using Apache as a frontend server or reverse proxy, as opposed to one Nginx, for example. You may want to be sure to pass the actual host IP and scheme information back to your application so that it may function properly. By default, mod_proxy sets the X-Forwarded-For header. But that header is a list, and is used by other types of proxies. You may want to set the X-Forwarded-Proto and X-Real-IP as well. The following entries into your VirtualHost or similar should do the job:

RequestHeader set X-Forwarded-Proto "%{REQUEST_SCHEME}s"
RequestHeader set X-Real-IP "%{REMOTE_ADDR}s"

Leave a Reply