Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache Reverse Proxy help |
|
Author |
|
Sim0nW0lf
Joined: 04 Jun 2021 Posts: 1 Location: Germany
|
Posted: Fri 04 Jun '21 11:43 Post subject: Apache Reverse Proxy help |
|
|
Hey I am here because I was hoping someone could help me with my reverse Proxy.
In my Nextcloud instance I get a warning and I couldn't remove it, so I opened a thread with exact details:
https://help.nextcloud.com/t/cant-get-rid-of-well-known-caldav-problem/117734/4
nursoda spotted that
Code: | curl -kI https://YOURSERVERNAME/.well-known/carddav |
should return location: https:// but for me it returns location: http:/
This is in my .htaccess file which I thought would take care of the issue but apparently doesn't:
Code: | <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} DavClnt
RewriteRule ^$ /remote.php/webdav/ [L,R=302]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule> |
I still think that's a reverse Proxy issue. Am I correct? How can I fix that, does anyone know?
Thanks in advance!
Cheers Simon |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 348 Location: UK
|
Posted: Fri 04 Jun '21 21:30 Post subject: |
|
|
Your various rewrite rules are site relative, so if the location result seen by the browser is http:// rather than https://, you need to determine where in the response this http:// prefix is coming from. Suggest you use developer mode on your browser (shift+control+i with Firefox or Chrome) to confirm where.
Chances are these erroneous redirects are being passed back in the response body from your non-secure proxied site, rather than location headers.
If it is in the response body, you may be able to use mod_substitute or mod_proxy_html to rewrite the proxied non-secure responses to https://
Also, I'd question using 301 redirects versus 302. The 301's are permanent, and so browsers cache this decision rather than checking the server. Hence, if you ever want to change your target, you'll find clients ignore you, until such time as the client cache is cleared. |
|
Back to top |
|
|
|
|
|
|