Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › Apache

How to Fix the ownCloud Redirect Loop (HTTP/HTTPS, Reverse Proxy, and Docker)

By Freedom251 Team · · 10 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An ownCloud redirect loop almost always means the URL your browser uses does not match the URL ownCloud thinks it is serving. The disagreement can be the protocol (http versus https), hostname, port, or webroot path. Behind a reverse proxy, correct the forwarded headers, explicitly trust the proxy, and use ownCloud’s overwrite settings only where automatic detection cannot work.

Diagnose the first changing part of the redirect chain before editing configuration. Then change one URL dimension, clear cached redirects, and verify the complete response sequence.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What an ownCloud redirect loop means

Each HTTP response can contain a Location header telling the browser where to go next. A loop occurs when those destinations cycle instead of reaching the login page or a file. Typical cycles look like:

  • https://cloud.example.com redirects to http://cloud.example.com, which redirects back to HTTPS.
  • https://cloud.example.com redirects to https://internal-host, then back to the public hostname.
  • https://cloud.example.com redirects to a non-default port and then loses that port.
  • https://cloud.example.com/owncloud alternates with https://cloud.example.com/.
  • The login page sends you to another hostname, where ownCloud starts a new login request.

ownCloud builds absolute URLs from the request information it receives. A reverse proxy may terminate TLS and connect to ownCloud over plain HTTP; unless the proxy and ownCloud agree that the public request was HTTPS, ownCloud can generate an HTTP redirect. The same problem occurs when the proxy hides the public host, changes the port, or mounts the application under a different path.

#1 Best Overall
Sale
UGREEN NAS DH2300 2-Bay for Beginners & Personal Users, Phone Backup | AI Album, Private Cloud/Remote Access, File Sharing, Multi-Device Backup, Home Entertainment, 4GB RAM on Board (Diskless)
  • Entry-level NAS Personal Storage:UGREEN NAS DH2300 is your first and best NAS made easy. It is designed for beginners who want a simple, private way to store videos, photos and personal files, which is intuitive for users moving from cloud storage or external drives and move away from scattered date across devices. This entry-level NAS 2-bay perfect for personal entertainment, photo storage, and easy data backup (doesn't support Docker or virtual machines).
  • Set Your Devices Free, Expand Your Digital World: This unified storage hub supports massive capacity up to 64TB.*Storage drives not included. Stop Deleting, Start Storing. You can store 22 million 3MB images, or 2 million 30MB songs, or 43K 1.5GB movies or 67 million 1MB documents! UGREEN NAS is a better way to free up storage across all your devices such as phones, computers, tablets and also does automatic backups across devices regardless of the operating system—Window, iOS, Android or macOS.
  • The Smarter Long-term Way to Store: Unlike cloud storage with recurring monthly fees, a UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $459.98 for a NAS, while for cloud storage, you need to pay $719.88 per year, $2,159.64 for 3 years, $3,599.40 for 5 years. You will save $6,738.82 over 10 years with UGREEN NAS! *NAS cost based on DH2300 + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Blazing Speed, Minimal Power: Equipped with a high-performance processor, 1GbE port, and 4GB RAM on Board, this NAS handles multiple tasks with ease. File transfers reach up to 125MB/s—a 1GB file takes only 8 seconds. Don't let slow clouds hold you back; they often need over 100 seconds for the same task. The difference is clear.
  • Let AI Better Organize Your Memories: UGREEN NAS uses AI to tag faces, locations, texts, and objects—so you can effortlessly find any photo by searching for who or what's in it in seconds. It also automatically finds and deletes similar or duplicate photo, backs up live photos and allows you to share them with your friends or family with just one tap. Everything stays effortlessly organized, powered by intelligent tagging and recognition.
URL dimension What must agree Typical symptom
Scheme Public http/https, TLS termination state, and forwarded protocol HTTP and HTTPS alternate indefinitely
Host Hostname users enter, proxy Host header, ownCloud overwrite value Public and internal names alternate
Port External port, forwarded host including port, and canonical redirect rules Redirects add or remove a port
Webroot Public path and proxy path mapping /owncloud is repeatedly added or removed

Identify the exact loop before changing settings

Use a header-only request

Run a request against the URL that users actually enter and preserve every redirect:

curl -I -L https://cloud.example.com/

Replace the example with your real public URL. Read every Location value in order. The first place where scheme, host, port, or path changes is the dimension to investigate. If the command appears to hang, stop it and repeat without -L so you can inspect one response at a time:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -I https://cloud.example.com/

Do not infer the cause from the browser error alone. A browser can retain a cached permanent redirect after you have fixed the server.

Inspect the browser Network panel

Open Developer Tools, select the Network tab, enable preservation of the log, and load the public URL in a private window. Select each 3xx response and record its status code and Location header. Compare the first request with the URL in the address bar. An alternation between two destinations points to canonicalization rules; a growing path usually indicates a webroot mapping error.

Clear cached redirects only after recording them

Use a private window for every test. If a normal window still loops after the server is corrected, clear that site’s cached data or test from another browser. This prevents an old 301 response from hiding whether the configuration change worked.

Rank #2
Sale
UGREEN NAS DXP2800 2-Bay for Advanced Home Users, Remote Workers & Creators | Home Media & Data Center, Docker & VM, Plex, Fast File Transfer, Intel N100, 8GB DDR5, 2.5GbE, 2x M.2 NVMe, 4K HDMI(Diskless)
  • 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
  • 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
  • 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
  • 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
  • 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.

Back up the configuration and establish the public URL

Before editing, copy config/config.php and write down the exact public URL, including a non-default port or subdirectory. Also note whether TLS terminates at the reverse proxy or at the ownCloud web server. The correct values depend on what users enter, not on the private address between proxy and backend.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Every hostname or IP address used to access ownCloud must be listed in trusted_domains. Include the public DNS name and any administrative IP or alternate name that is genuinely used. Do not add an arbitrary wildcard or an entire network just to suppress an error; an over-broad list weakens host validation.

Set the reverse-proxy trust and canonical URL

Reference configuration

Use the following pattern only after replacing each value with the values in your deployment:

// config/config.php
$CONFIG = [
  'trusted_proxies' => ['10.0.0.10'],
  'trusted_domains' => ['cloud.example.com'],
  'overwritehost' => 'cloud.example.com',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/owncloud',
  'overwrite.cli.url' => 'https://cloud.example.com/owncloud',
];

trusted_proxies must contain only the proxy addresses that ownCloud is meant to trust. ownCloud’s Server Administration Manual warns that incorrect forwarded-header settings can let clients spoof their apparent IP. Do not place an arbitrary subnet in this setting. If several controlled proxies can reach the backend, list those specific addresses.

What each overwrite option controls

  • overwritehost: the externally visible hostname, with the external port when that port is not the default. Set it when the backend sees an internal name or the wrong port.
  • overwriteprotocol: the public scheme, normally https when TLS ends at the proxy. Set it when ownCloud sees an HTTP backend connection despite an HTTPS browser request.
  • overwritewebroot: the path users see, such as /owncloud. Set it when the proxy publishes ownCloud below a subdirectory and automatic detection fails.
  • overwrite.cli.url: the complete base URL used by cron and links generated by occ. A wrong value can send users to another domain and prompt another login.

Do not set a value merely because it appears in an example. A root deployment should not be given /owncloud, and a site that is genuinely HTTP should not be forced to HTTPS. Change only the option corresponding to the dimension you identified.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BUFFALO LinkStation 210 2TB 1-Bay NAS Network Attached Storage with HDD Hard Drives Included NAS Storage that Works as Home Cloud or Network Storage Device for Home
  • Value NAS with RAID for centralized storage and backup for all your devices. Check out the LS 700 for enhanced features, cloud capabilities, macOS 26, and up to 7x faster performance than the LS 200.
  • Connect the LinkStation to your router and enjoy shared network storage for your devices. The NAS is compatible with Windows and macOS*, and Buffalo's US-based support is on-hand 24/7 for installation walkthroughs. *Only for macOS 15 (Sequoia) and earlier. For macOS 26, check out our LS 700 series.
  • Subscription-Free Personal Cloud – Store, back up, and manage all your videos, music, and photos and access them anytime without paying any monthly fees.
  • Storage Purpose-Built for Data Security – A NAS designed to keep your data safe, the LS200 features a closed system to reduce vulnerabilities from 3rd party apps and SSL encryption for secure file transfers.
  • Back Up Multiple Computers & Devices – NAS Navigator management utility and PC backup software included. NAS Navigator 2 for macOS 15 and earlier. You can set up automated backups of data on your computers.

Use conditional overwrites when multiple entry points exist

If only requests arriving from one proxy should receive an overwrite, use overwritecondaddr with a regular expression matching that proxy’s address. This is safer than forcing the same public URL on direct administrative access or on a second, differently configured proxy. The condition must match the actual source address ownCloud sees.

Fix an HTTP/HTTPS alternation

When TLS terminates at a reverse proxy

  1. Confirm that the browser connects to the proxy with HTTPS.
  2. Confirm that the proxy forwards the original public host and a forwarded protocol value indicating HTTPS. The relevant information is usually the Host and X-Forwarded-Proto (or equivalent standardized forwarded protocol) header.
  3. Ensure the proxy address is in trusted_proxies, and set overwriteprotocol to https if automatic detection still sees HTTP.
  4. Remove any second HTTP-to-HTTPS rule that conflicts with the proxy’s canonical redirect. There should be one authoritative scheme decision.
  5. Repeat the header request and verify that the first HTTPS request no longer returns a Location pointing to HTTP.

If TLS terminates directly on the ownCloud web server, the backend should receive the real HTTPS request and normally does not need a protocol overwrite. Forcing https in that case can conceal a different proxy or virtual-host error, so verify the termination point first.

Check for conflicting scheme rules

A proxy may redirect HTTP to HTTPS while an Apache or Nginx virtual host behind it redirects what it believes is HTTP back to another address. Keep one canonical rule at the edge and make sure the backend receives a trustworthy indication of the original scheme. Do not stack independent HTTP-to-HTTPS rules in the proxy, web server, and application without checking how each one interprets forwarded headers.

Fix hostname or port alternation

  1. List every hostname and port in the recorded Location chain.
  2. Choose the single public host and port that users should enter.
  3. Configure the proxy to pass that public Host, including the port when it is non-default.
  4. Set overwritehost to the same external host and port if ownCloud cannot reliably detect it.
  5. Remove a competing canonical redirect in another virtual host, load balancer, or proxy layer.
  6. Add the exact public hostname (and any genuinely used alternate IP or name) to trusted_domains.

A host redirect can look like a login problem: the first page loads under one name, authentication is submitted to another, and the session appears to disappear. Check the hostname in every response before changing cookies or credentials.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix a path or /owncloud loop

Decide whether the public deployment is at the domain root (https://cloud.example.com/) or under a subdirectory (https://cloud.example.com/owncloud/). The proxy mapping, overwritewebroot, and overwrite.cli.url must describe that same choice.

Rank #4
Sale
UGREEN NAS DH4300 Plus 4-Bay for Beginners, Home Users & Remote Workers | Photo & Video Backup, AI Photo Album, File Hub, Private Cloud & Secure Home Surveillance, 8GB LPDDR4X, 4K HDMI (Diskless)
  • Entry-level NAS Home Storage: The UGREEN NAS DH4300 Plus is an entry-level 4-bay NAS that's ideal for home media and vast private storage you can access from anywhere and also supports Docker but not virtual machines. You can record, store, share happy moment with your families and friends, which is intuitive for users moving from cloud storage, or external drives to create your own private cloud, access files from any device.
  • Smart Photo Backup & AI Album: Automatically back up photos and videos from your phone in real time and keep growing family memories organized with AI-powered photo albums. Semantic search, custom learning, and recognition of people, objects, pets, and similar photos help you quickly find the moments you want. Duplicate photo removal also helps keep your library organized—ideal for families and users with large photo collections.
  • User-Friendly App & Easy Setup: Connect quickly via NFC, set up simply and share files fast on Windows, macOS, Android, iOS, web browsers, and smart TVs. You can access data remotely from any of your mixed devices. What's more, UGREEN NAS enclosure comes with beginner-friendly user manual and video instructions to ensure you can easily take full advantage of its features.
  • More Cost-effective Storage Solution: Unlike cloud storage with recurring monthly fees, A UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $629.99 for a NAS, while for cloud storage, you need to pay $719.88 per year, $1,439.76 for 2 years, $2,159.64 for 3 years, $7,198.80 for 10 years. You will save $6,568.81 over 10 years with UGREEN NAS! *NAS cost based on DH4300 Plus + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
  • Your Data, You Control:No third-party clouds, no hidden access, UGREEN NAS provides a more secure and private data storage solution. It stores data locally on your private hard drives and does automatic backups. Thus, you can keep full control over it. The advanced encryption is TRUSTe certified in the United States and is awarded the first (and only) ETSI EN 303 645 certification mark for NAS products by TÜV SÜD Group.

Subdirectory deployment

For a public path such as /owncloud, map that path to the matching backend path and set overwritewebroot to /owncloud. The complete CLI base URL should include the path. In Apache, the mapping requires both a forward proxy rule and a matching reverse rewrite; the official ownCloud example shows paired ProxyPass and ProxyPassReverse directives for this reason. If only the forward rule exists, backend redirects can expose an internal or path-less URL.

ProxyPass        /owncloud  http://127.0.0.1:8080/owncloud
ProxyPassReverse /owncloud  http://127.0.0.1:8080/owncloud

Use the actual upstream address and path for your installation. Do not copy these values unchanged into a different layout.

Root deployment

If users enter the domain root, remove an obsolete /owncloud prefix from the proxy mapping and from ownCloud’s webroot overwrite. Leaving one layer configured for a subdirectory and another for the root creates repeated path additions or removals.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make host validation pass

An “untrusted domain” message is separate from a redirect loop but often appears during the same migration. Add the exact public hostname or IP to trusted_domains, save the configuration, and test that same address. Include a non-default port only where your ownCloud version expects it as part of host validation; do not substitute a broad wildcard for the real name.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Docker-specific settings

In the official ownCloud Docker setup, OWNCLOUD_TRUSTED_DOMAINS supplies the trusted host list as a comma-separated value when more than one name is required. OWNCLOUD_DOMAIN is used when OWNCLOUD_TRUSTED_DOMAINS is not defined. Set the variable that your deployment actually uses, using the public hostname rather than the container name.

Best Value
Synology 2-Bay DiskStation DS223j (Diskless)
  • Secure private cloud - Enjoy 100% data ownership and multi-platform access from anywhere
  • Easy sharing and syncing - Safely access and share files and media from anywhere, and keep clients, colleagues and collaborators on the same page
  • Automated Backup Protection - Set-and-forget backups for Macs, PCs and mobile devices to multiple destinations including cloud and external drives
  • Home Security System - Record and monitor your property 24/7 with support for multiple IP cameras and remote viewing
  • 2-Year Warranty - Reliable hardware backed by Synology's expert customer support team and ongoing software updates
  1. Inspect the environment and generated ownCloud configuration inside the running container so you know which variable currently supplies the value.
  2. Replace it with the exact public hostname or a comma-separated list of real entry points.
  3. Restart the service; changing a compose or container environment value does not alter an already running process until it is recreated or restarted.
  4. Re-run the header request from outside the container and verify the public scheme, host, port, and path.

Docker networking addresses are normally internal implementation details. They should not become the hostname in redirects unless that is intentionally the public URL.

Choose a deployment pattern that matches the URL users enter

Choice Advantages Configuration consequences
TLS at reverse proxy Centralizes certificates and lets the proxy serve several backends Forward the public host and HTTPS protocol, trust the proxy, and set overwriteprotocol when detection is unreliable
TLS at ownCloud web server The backend sees the original secure request directly Fewer forwarded-header concerns; proxy rules must still preserve host, port, and path if a proxy remains in front
Root deployment (/) Shortest public URLs Do not retain a subdirectory webroot or path prefix in proxy rules
Subdirectory deployment (/owncloud) Allows another application at the domain root Proxy mapping, overwritewebroot, and CLI URL must all include the same prefix
Static overwrite values Predictable for one fixed public entry point Can break alternate entry points; values must be changed when the public URL changes
Conditional overwritecondaddr Limits overwrites to requests from a known proxy Requires an accurate regular expression for the proxy address and careful testing of direct access

The right choice is the one that describes the URL users actually enter and the headers the proxy actually sends. Mixing choices across layers is what creates most loops.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Apply changes safely, one dimension at a time

  1. Back up: copy config/config.php and save the current redirect chain.
  2. Classify: decide whether the first change is scheme, host/port, or path.
  3. Correct the edge: fix the proxy’s forwarded host, protocol, or path mapping first.
  4. Correct ownCloud: add the specific proxy to trusted_proxies and apply only the matching overwrite option.
  5. Validate hosts: add every real public hostname or IP to trusted_domains.
  6. Restart what needs restarting: recreate a Docker service after environment changes; reload the web server after its configuration changes.
  7. Retest privately: use a private browser window and a header-only request, recording every Location.
  8. Review logs: if the chain still changes, correlate proxy, web-server, and ownCloud log entries by timestamp.

Do not simultaneously change cookies, authentication providers, database settings, and URL configuration. Isolating one dimension makes the first remaining mismatch visible and preserves a straightforward rollback.

When the loop remains

The proxy header is missing or untrusted

If ownCloud ignores X-Forwarded-Proto or the forwarded host, verify that the request really comes from an address in trusted_proxies. A header from an untrusted source must not be accepted as authoritative. Check the proxy’s outgoing request rather than assuming its configuration file is active.

Two proxies are rewriting different ways

Trace the request through every load balancer, CDN, ingress controller, and web server. The first layer may set HTTPS while the next replaces it with HTTP, or one layer may strip /owncloud while another adds it. Give each layer one consistent mapping and remove duplicate canonical redirects.

The response points to an internal URL

An internal hostname, container name, or private port in Location indicates that ownCloud or the proxy is exposing backend information. Set the public host and port, ensure the public Host is forwarded, and check Apache’s ProxyPassReverse or the equivalent response-rewriting feature.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Only cron or occ links are wrong

If interactive browsing works but generated links point elsewhere, inspect overwrite.cli.url. It must be the complete public base URL, including scheme and webroot. Correcting that value does not replace the need to fix browser redirects if those still loop.

A cached 301 survives the fix

Confirm the server’s current chain with curl or a private window. Then clear the affected site’s cached data in the regular browser. Do not keep editing server settings to compensate for a redirect that is no longer being returned.

Final verification checklist

  • The public URL reaches one canonical scheme, host, port, and path.
  • Every response in the chain has a useful destination and the chain terminates.
  • The proxy sends the public Host and correct forwarded protocol.
  • Only intended proxy addresses are in trusted_proxies.
  • Every real public hostname or IP is in trusted_domains.
  • overwritehost, overwriteprotocol, and overwritewebroot match the external URL, or are omitted where automatic detection is correct.
  • overwrite.cli.url matches the same complete base URL.
  • Docker environment changes have been applied by restarting or recreating the service.
  • A private-window test and a header request both reach the login page without alternating destinations.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

ApacheDockerHTTPS troubleshootingNGINXownCloudredirect loopreverse proxy

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.