Unwanted HTTPS->HTTP Redirects

Hello NextCloud community!

Would someone please point me in the right direction for fixing a NextCloud setup issue?
It works almost perfectly, except for some https->http redirects on certain URLs.

(This will be awkward because I’m only allowed 4 links in this post, even though they’re all literally for example DOT com… see picture at the end for details.)

My Setup:

https://files.example.com/ -> Nginx Reverse Proxy w/SSL (port 443) -> Ubuntu Docker Host (port 8080) -> NextCloud Docker Container (port 80)

Response headers:

HTTP/1.1 302 Found
Location: http://files.example.com/login

HTTP/1.1 303 See Other
Location: http://files.example.com/apps/files/

HTTP/1.1 303 See Other
Location: http://files.example.com/login?clear=1

There doesn’t seem to be anything disruptive in apache2.conf or sites-enabled.
Maybe I change something in NextCloud’s configuration to correct this?


If you look in the NC server documentation under reverse proxy, there’s an option called overwrite protocol. Have you set it?

Ah, I didn’t think to look there… found it!

Okay, this command seems to have fixed my problem:

docker exec --user www-data nextcloud php occ config:system:set overwriteprotocol --value="https"