DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › Apache

How to Force HTTPS on a Self-Hosted ownCloud Server

By Freedom251 Team · · 10 min read

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

Force HTTPS at the server or reverse-proxy edge: install a valid certificate, make the HTTPS endpoint work, then redirect the port-80 virtual host to the public HTTPS address with a permanent 301. If TLS terminates at a proxy, add that proxy to trusted_proxies and set overwriteprotocol to https when ownCloud generates HTTP links. Add HSTS only after certificates, subdomains and renewal are proven reliable.

What forcing HTTPS changes

HTTPS encrypts the connection between a client and the endpoint that terminates TLS. Without it, credentials, files and session data can be intercepted or modified. ownCloud’s security guidance warns that using the service over unencrypted HTTP exposes it to man-in-the-middle attacks and interception of user data and passwords.

As an Amazon Associate I earn from qualifying purchases.

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.

A redirect alone does not provide encryption. The browser must first be able to complete a valid TLS handshake on port 443. Once that works, the port-80 site can issue a permanent 301 redirect to the same path on the HTTPS hostname. Requests that arrive through a proxy need an additional layer of configuration so ownCloud knows the original request used HTTPS.

Prerequisites before changing the redirect

  • One canonical public hostname. Decide whether users will access the service as, for example, cloud.example.com. Use that hostname consistently in DNS, the certificate, the proxy and ownCloud settings.
  • DNS and reachability. Point the hostname at the public server or TLS-terminating proxy. Verify that ports 80 and 443 reach the intended edge device rather than an old virtual host.
  • A valid certificate. Install a certificate whose name covers the public hostname. Test renewal before relying on a long-lived redirect or HSTS policy.
  • Correct host and protocol forwarding. A proxy must pass the original host and indicate that the client-side scheme was HTTPS. Keep a record of the proxy’s source IP addresses.
  • An administrator rollback path. Keep console or out-of-band access available. A bad certificate, redirect loop or HSTS policy can prevent ordinary browser access.

Implementation sequence

  1. Point DNS to the public server or reverse proxy and confirm that ports 80 and 443 arrive at the correct edge.
  2. Obtain and install the TLS certificate for the public hostname.
  3. Confirm that the HTTPS virtual host or proxy forwards the original host and protocol to ownCloud.
  4. Add a permanent HTTP-to-HTTPS redirect on the port-80 listener.
  5. If a proxy terminates TLS, add its address to trusted_proxies.
  6. Set overwriteprotocol to https when ownCloud still believes requests are HTTP. Add host or webroot overrides only when those values are also detected incorrectly.
  7. Test interactive login, generated links, WebDAV clients, sharing links and cron-generated URLs through the public HTTPS hostname.
  8. Add HSTS after certificate renewal and every required subdomain have been checked.

Apache: redirect port 80 and serve HTTPS

Configure the HTTP virtual host

On Apache, leave the port-80 virtual host available solely to redirect the canonical hostname. The documented pattern is:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
<VirtualHost *:80>
  ServerName cloud.example.com
  Redirect permanent / https://cloud.example.com/
</VirtualHost>

Redirect permanent returns HTTP status 301. It preserves the requested path when Apache builds the destination, so a request such as /remote.php/dav/files/user/ is sent to the corresponding HTTPS path. Use the exact public hostname users should see; redirecting to an internal name creates confusing links and can expose infrastructure details.

Verify the TLS virtual host first

The HTTPS virtual host must present the certificate, load the ownCloud application and proxy or pass requests to the correct backend before the port-80 redirect is enabled. Test a login and a known file URL directly on https://cloud.example.com. If that endpoint fails, fix the certificate, virtual-host matching or backend routing instead of adding more redirects.

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

Use HSTS only on the working HTTPS host

After HTTPS is stable, add the Strict-Transport-Security response header on the TLS virtual host. ownCloud’s example uses max-age=15768000; includeSubDomains; preload. The max-age value is 15,768,000 seconds, and the policy tells a browser to replace future HTTP requests with HTTPS without contacting port 80 first.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Include includeSubDomains only when every subdomain beneath the hostname is HTTPS-capable. A forgotten administration, monitoring or legacy subdomain can become unreachable after the policy is cached. HSTS is stronger than a redirect: a certificate error or HTTP-only subdomain can block access until the policy expires or is removed in the browser.

Reverse proxies and TLS termination

Why links become HTTP

When Nginx, HAProxy, Cloudflare or another edge proxy accepts HTTPS and forwards plain HTTP to the ownCloud host, the application may see the backend connection rather than the original client connection. It can then generate http:// links, redirect users to an internal hostname or create incorrect WebDAV endpoints even though the browser is using HTTPS.

The proxy must forward the original host and protocol, and ownCloud must be configured to trust the proxy that supplies those headers. Do not trust arbitrary client-supplied forwarding headers: ownCloud warns that incorrect forwarded-header settings can allow clients to spoof their apparent address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Trust only the proxy addresses

Add the fixed IP address or addresses of the TLS-terminating proxy to trusted_proxies. Do not use a broad network range unless every address in that range is controlled and can send trusted forwarding headers. If the proxy’s address changes, update the setting deliberately and reload the application.

'trusted_proxies' => ['10.0.0.10'],

The address in this example is illustrative of the configuration shape. Replace it with the actual source address ownCloud sees for proxy requests. If multiple controlled proxies can connect directly, list each one.

Tell ownCloud that the public scheme is HTTPS

Set overwriteprotocol when the proxy has terminated TLS but ownCloud cannot detect that fact:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
'overwriteprotocol' => 'https',

ownCloud documents http and https as the accepted values. Apply this override only when the protocol is misdetected; leaving unrelated values unset reduces the chance of masking a proxy-routing error.

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

Correct an internal hostname or path only when necessary

If generated links still contain an internal host, set overwritehost to the public name. If ownCloud is published below a URL prefix, set overwritewebroot to that public path. For a service published at the root of the hostname, the documented example is:

'overwritehost' => 'cloud.example.com',
'overwritewebroot' => '/',

Do not add a host or webroot override merely because a proxy is present. First inspect the request and forwarding headers; an override that does not match the public URL can break sharing links and WebDAV clients.

Proxy validation checklist

  • Open the public HTTPS URL and confirm that the address never changes to an internal hostname.
  • Create a sharing link and verify that it begins with https:// and the public host.
  • Connect a WebDAV client through the public URL, not the backend address.
  • Run a scheduled task that emits a URL and inspect the resulting hostname and scheme.
  • Review access logs to confirm that only the known proxy addresses are supplying trusted forwarding information.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Docker deployments

Containerized ownCloud installations have two configuration layers: the proxy or web server at the edge and the container environment. Keep the public HTTPS hostname identical in both layers. The official Docker guidance calls out OWNCLOUD_DOMAIN, OWNCLOUD_TRUSTED_DOMAINS and OWNCLOUD_OVERWRITE_CLI_URL. The environment-variable reference also provides settings for overwrite protocol, host, webroot and trusted proxies.

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

Align the container with the public URL

  • Set OWNCLOUD_DOMAIN to the public HTTPS hostname used by browsers.
  • Include that hostname in OWNCLOUD_TRUSTED_DOMAINS so host validation accepts the public request.
  • Set OWNCLOUD_OVERWRITE_CLI_URL to the public HTTPS URL when command-line jobs generate links that otherwise point at the internal address.
  • Use the corresponding overwrite-protocol, overwrite-host, overwrite-webroot and trusted-proxy environment settings when the proxy’s topology requires them.
  • Use an explicit image version rather than the latest tag so a restart does not silently change the application while you are troubleshooting URL generation.

After changing environment variables, recreate or restart the container according to your deployment method and then test from outside the Docker network. A container can resolve its backend hostname correctly while users still receive unusable internal links if the public values are not aligned.

Choosing where TLS terminates

Termination location Operational ownership Certificate and headers Important checks
Apache or Nginx on the ownCloud host The ownCloud server team manages the listener, certificate and redirect. The same host serves HTTPS and can add HSTS directly. Ensure the HTTPS virtual host is correct before enabling the port-80 redirect.
Separate reverse proxy The edge team manages TLS while the ownCloud host receives proxied traffic. The proxy renews the certificate and must forward host and protocol accurately. Restrict trusted_proxies to known proxy addresses and set overwrite values only for misdetected fields.
Managed edge service The provider handles the public certificate; you control origin and application settings. HSTS and forwarding behavior depend on the edge configuration. Confirm the origin sees the expected host, scheme and proxy source address before enforcing HSTS.

There is no universally safer termination point. A local web server keeps the configuration close to ownCloud; a separate edge can centralize certificates and protect several services. The deciding factors are who owns renewal, how client IP and forwarding headers are controlled, whether port 80 is exposed, and which layer is the source of truth in a Docker deployment.

Testing after the change

Browser and redirect tests

  1. Visit the public HTTP URL and confirm one 301 leads to the equivalent HTTPS URL.
  2. Visit the HTTPS URL directly and inspect the certificate name, validity and renewal date.
  3. Open a deep path, such as a login or shared-file URL, and verify that its path and query string survive the redirect.
  4. Sign out and sign back in to detect cookie or session issues that a cached browser session can hide.

Application-generated URL tests

  • Create a new sharing link and open it in a private browser window.
  • Check notification emails or other messages generated by ownCloud for the public HTTPS hostname.
  • Connect a WebDAV client and perform both a directory listing and a file transfer.
  • Run cron or background jobs and inspect any URL they log or send.
  • Test from outside the local network so split-DNS or an internal certificate does not give a false result.

What success looks like

Every user-facing URL starts with the public https:// scheme, no request loops between HTTP and HTTPS, WebDAV accepts the same public endpoint, and the certificate presented to an external client matches the hostname. The backend may still use HTTP on a protected internal network; that does not remove the need to configure the original scheme correctly at the application layer.

Troubleshooting common failures

Symptom Likely cause Fix
HTTP redirects repeatedly between HTTP and HTTPS The proxy reports the wrong scheme, or an overwrite rule conflicts with the edge configuration. Verify the proxy’s forwarded protocol, trust only the proxy address, then use overwriteprotocol => 'https' only when ownCloud still detects HTTP.
Links contain an internal hostname The backend host is being used for URL generation. Correct the forwarded host or set overwritehost to the public hostname.
Links omit or duplicate a URL prefix The public webroot and backend path differ. Fix proxy path forwarding or set overwritewebroot to the actual public path.
Clients can spoof their apparent address Untrusted forwarding headers are accepted. Restrict trusted_proxies to controlled proxy IP addresses and correct the edge header policy.
Certificate warning on the public URL The certificate is expired, issued for another name or not installed on the listener users reach. Install a valid certificate for the public hostname and test renewal before re-enabling strict policies.
HSTS prevents access after a change The browser cached a policy while a certificate or subdomain was broken. Repair HTTPS and the affected subdomain; browsers continue enforcing HSTS until its cached policy expires or is removed locally.
Docker users receive stale or internal URLs Container environment values do not match the proxy’s public URL. Align the domain, trusted domains, CLI URL and required overwrite settings, then recreate the container.

HSTS: when to enable it

HSTS is a commitment that the hostname will remain available over valid HTTPS. It protects repeat visitors even if they type an HTTP URL or follow an insecure link, because the browser upgrades the request before sending it. That strength also makes mistakes harder to recover from.

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

Use the documented six-month policy only after you have verified certificate renewal, every required subdomain and all administrative paths. Add includeSubDomains only when those subdomains are ready. Treat preload as an additional operational commitment rather than a routine switch; removing a hostname from browser preload systems is not an instant rollback.

Security and maintenance rules

  • Keep the permanent redirect at the edge so unauthenticated HTTP requests never reach application logic unnecessarily.
  • Renew certificates before expiry and monitor the renewal result, not merely the scheduled job.
  • Document which component owns DNS, certificates, redirects, forwarding headers and ownCloud URL overrides.
  • Recheck trusted_proxies after network changes. A proxy address that is no longer controlled should be removed.
  • Use one canonical hostname in bookmarks, mobile clients, WebDAV configuration and automation.
  • After upgrades or container recreation, repeat deep-link, sharing, WebDAV and cron tests; URL-generation regressions often appear outside the main browser page.

Final verification checklist

  1. DNS resolves the public hostname to the intended edge.
  2. Port 443 presents a valid certificate for that hostname.
  3. Port 80 returns one permanent redirect to the equivalent HTTPS URL.
  4. The proxy forwards the original host and HTTPS scheme.
  5. Only known proxy addresses appear in trusted_proxies.
  6. OwnCloud generates HTTPS links with the public hostname and correct webroot.
  7. Login, sharing, WebDAV and scheduled jobs work through the public URL.
  8. HSTS is enabled only after renewal and subdomain checks pass.

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.

ApacheDockerHSTSHTTPSNGINXownCloudreverse proxyServer SecurityTLS

Leave a Reply

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

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

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.