Conversation
…ity (partially from mod_rpaf, extended) [*] Tested against 2.4.41
|
Actually Apache 2.4.48 allows to completely integrate this module patch without any hacky tricks it seems. |
|
Hello, We're using Caddy as a TLS terminator for our apache. Caddy communicates with apache using http (well actually h2c) on localhost. For compatibility reason with other modules we need to use apache 2.4.37 (centos package) and we found this patch for mod_remoteip that seems to work on 2.4.37 after a bit of editing. Here is the edited patch that compiles with 2.4.37: However, with our config it works as long as we request the homepages of the sites. (https://site.tld). We found out that setting All requests to apache are being made by Caddy through loopback interface and they are declared as InternalProxies. Thanks a lot for the help. Kind regards. |
|
Hello Sebastien, Please try to adjust the following one for your version of Apache (it is the last version of the pre-#191 patch): Take care this one (#68) is obsolete and contains SSL flag 'emulation' hacks that may give errors under some very specific configurations. If possible at all, newer Apache versions and #191 should be used instead. If you are using H2 for this one, please also try to use just normal HTTP instead for frontend to backend connections. H2 in older 2.4 versions actually gave me a lot of pain and since then I ditched any attempts to use it for backends, that is patch unrelated. |
|
Hello Alex and thanks a lot for the information. I was able to recompile mod_remoteip with the latest pre-#191 patch on 2.4.37. It compiled without the need to adapt it. However the issue persisted when setting After a bit of trial and error, I found out that adding these headers in caddy reverse proxy fixed the problem: This is was very strange because by default it is supposed to populate automatically So it turns out that when it populates it automatically the It seems to me that it is what is causing the 403 errors we get when using Could it makes sense? |
|
Hard to tell without protocol trace to be honest. |
|
Yes, you're right. Again thanks a lot! |
While 'protocol' (HTTPS) part of it looks a bit hacky, I think this deserves to be included one way or other, it's pretty much helpful when running behind (popular nowadays) reverse proxies. Basically, this one extends mod_remoteip to support RemoteHost, RemotePort and RemoteProto, allowing for mangling Host header, using different ports and transitioning HTTPS to HTTP.
More details (and configuration details) here: https://alex-at.ru/blog/apache-mod_remoteip-mod_rpaf
I'm ready to work on that to bring it to the applicable state if something is wrong with it. HTTPS part surely looks hacky, so I'm eager to get expert opinions on how to make this proper.