I have Apache set up as a load balancer. I wanted to make apache set the X-Forwarded-Proto header, but this doesn't work:
RequestHeader set X-Forwarded-Proto "%{SERVER_PROTOCOL}e"
The header gets set to null. Any idea why?
|
I have Apache set up as a load balancer. I wanted to make apache set the X-Forwarded-Proto header, but this doesn't work:
The header gets set to null. Any idea why? |
|||
|
|
|
You don't want that; it'd set your header to "HTTP/1.1" (even on an https request) - probably not terribly useful to whatever you're passing to. You have different VirtualHost blocks for http and https; just hardcode the
|
|||
|
|
Found the cause. Turns out it is an order of operations issue. mod_rewrite is responsible for supplying these environment variables, but Apache doesn't process it until AFTER it handles any ProxyPass requests. Until then, it will just set null. The only workaround appears to be to do the proxying via mod_rewrite. See http://www.gossamer-threads.com/lists/apache/users/267160?do=post_view_threaded#267160 |
|||
|
|
|
Late but still, I've just dealt with the same issue, and this worked for me:
The documentation says:
While the HTTPS environment variable is only set when the request is made through SSL. |
|||
|
|
|
You can fix this by using the
Otherwise, you can do what John Crenshaw suggested, which is use |
|||
|
|