Where is this URL rewrite happening?

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 16.0.1
Operating system and version (eg, Ubuntu 17.04): RHEL 8
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.37
PHP version (eg, 7.1): PHP 7.3.5

The issue you are facing:

I have a bit of an odd one. I have a Nextcloud installation that should be accessible via 3 different addresses: my internal IP address, my internal nextcloud hostname, my internal reverse proxy hostname. The weird part is that while accessing Nextcloud via the reverse proxy works just fine using both proxy.domain.name as well as proxy.domain.name/login.php/login, access using ipaddress and nternal.nextcloud.hostname ONLY works with the full URL that includes /login.php/login

If i try accessing ipaddress or internal.nextcloud.hostname omitting the full URL, all browsers eventually give a timeout error. Running curl -I against either one I notice 2 curious lines:

HTTP/1.1 302 Found
Location: https://internal.ip.address/index.php/login


HTTP/1.1 302 Found
Location: https://internal.nextcloud.hostname/index.php/login

A-ha! Took me a REALLY long time to eventually notice the s in the URL. So something, somewhere on the machine running Nextcloud is trying to do an URL rewrite and pass me on from http to https. This brings me to my question: Where could the rewrite be happening? I am not seeing anything relevant in neither nextcloud.conf nor httpd.conf and looking at nextcloud/.htaccess I only see a bunch of rules that only apply when: “RewriteCond %{HTTP_USER_AGENT} DavClnt”.

Nevermind, solved: I somehow managed to miss ‘overwriteprotocol’ in config.php :sweat_smile: