Last active
December 19, 2023 19:09
-
-
Save ollyg/5782078 to your computer and use it in GitHub Desktop.
Setting X-REMOTE_USER in Apache proxied request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RequestHeader unset X-REMOTE_USER | |
RequestHeader set X-REMOTE_USER "%{REMOTE_USER}e" env=REMOTE_USER | |
# see http://httpd.apache.org/docs/current/mod/mod_headers.html#header |
Specifically when Apache is running a reverse proxy together with local authentication within Apache (for example mod_webauth), there is a legitimate use case for the config above to pass the username set by authentication through to the proxied app. I can imagine without this context it would not seem a very useful configuration.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The example above is incorrect, because it assumes REMOTE_USER is an environment variable. It is not (unless some non-standard additional configuration has additionally defined such a variable).
Instead it is a special property of the request, best accessed via expr= functionality (2.4.10 or later required)