There's a lot of information on how to make WordPress 'work' behind a reverse proxy or load balancer when using TLS offloading at the edge. A lot of these workarounds involve hacking up the wp-config.php
file and passing the X-Forwarded-Proto
header down stream to the web server sitting in front of WordPress and then to WordPress itself.
That's all fine, but these methods assume you are NOT using the Proxy Protocol (version 2).
I'd like to know what's the correct and most cleanest way to tell WordPress that TLS is being offloaded by something else and it shouldn't try to redirect the requests to HTTPS, thus causing a redirect loop.
The architecture is as follows:
End-to end from the edge all the way to the HTTP server in front of Wordpress, the PROXY protocol is in use. The pipeline is long but it's that way for a reason. Sure there's room for improvement, but that's not the topic for this question.
How should I configure the Apache web server and WordPress?
For example, is there a way to set these Apache directives using information passed by the PROXY protocol?
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
Or is there a much more elegant approach to solving the problem?