Forcing https on owncloud

I have a clean installation of ownCloud and everything is working fine. I used the installation wizard for the installation and ownCloud is installed in /var/www/owncloud.
In the /etc/apache2/sites-available folder I have owncloud.conf but no vhost file.
I have a working ssl certificate and can access ownCloud with https. I want to enforce https and have tried Redirect permanent / https://example.com/ and other suggestions but nothing works.

I'm obviously doing something wrong so does anyone have any suggestions please?
Thanks,
Cliff

Server configuration
Operating system: Ubuntu 16.04
Web server: Apache 2.4.18
Database: MariaDB 10.0.27
PHP version: 7.0.8
ownCloud version (see ownCloud admin page): 9.1.1
Updated from an older ownCloud or fresh install: Fresh install updated from 9.1 to 9.1.1
Special configuration (

Hi,

moving to the miscellenaous category as the whole redirect and ssl topic is the job of your webserver.

I guess you should find tons of tutorials on the net how to redirect from http to https. There is even a part for this in the documentation:

https://doc.owncloud.org/server/latest/admin_manual/configuration_server/harden_server.html#redirect-all-unencrypted-traffic-to-https

As teaching people webservers basics is out of the scope of this forums you might get further help in forums like http://www.apachelounge.com/

RealRancor is right, this is an issue with your webserver config, not an ownCloud problem, so you probably shouldn't be asking here.

But my first impression is that the http address may exist in more than one place. You should check other files (e.g. http.conf) to see if your web server defaults to the http version of owncloud.

Good luck!

You could always do a rewrite using a htaccess file.

But, I'd second the ideas here that say it is a config problem. I've got mine 100% behind https (I have http disabled on apache) and everything works great.

Hi,

it shouldn't be a problem to ask such questions in here. We had created the Miscellaneous category exactly for that. :slight_smile:

However topics like SSL and such redirects are that common questions these days which are answered at so many resources out there that its highly recommended to search for answers on the net.

1 Like

The redirect directly in your apache config is not a bad idea. however, it must be in the right place (vhost for http host). There is a simple example in the apache-docs:
https://httpd.apache.org/docs/2.4/rewrite/avoid.html#redirect

I very happily stand corrected :slight_smile:

When getting started, it's often hard to tell where your problems stem from (ownCloud, Apache, Let's Encrypt, the OS, etc), especially if you're relatively inexperienced. I unpleasantly remember the anti-help I got from many linux forums ("read the fucking manual!", even if there was no entry to read) when I was learning back in the 90s, so now I try to point people to the appropriate area, then try to answer their question anyway. That way, I either help with direct advice, or help with an alternative forum.

Either way, it's better than how I learned. I'm glad the ownCloud forum isn't so retro :wink:

It's okay to ask questions here, but if you simply search for "force https" you'll find this has been asked and answered more than once already.

I’m having the same issue, and it’s NOT an Apache configuration issue. I had OwnCloud 9.0.1 configured to use https with no issues. I have not changed my Apache configuration. I upgrade to 9.1.8, and now OwnCloud refuses to run on https. The https page loads fine (proving that the Apache conf still works), but if I log in, OwnCloud redirects me back to http from https.

If I redirect from http to https in Apache conf OR in .htaccess, I get an error message that “The page isn’t redirecting properly.”

My OwnCloud config.php has the site URL as https. Not sure where else this is supposed to be configured, but it’s frustrating.

But here:

2 Likes

FWIW, I had a similar problem, using the docker-compose setup for oC10.6, with a TLS-terminating proxy in front.

The login page would display correctly on https://example.com/login and POST to that same URL over https, but then ownCloud would respond with a 303 redirect to http://example.com/apps/file which was obviously not what I wanted.

I was able to resolve it by entering the Docker container (docker exec -it owncloud-compose_owncloud_1 /bin/bash), running vim config/config.php in there, and adding a line 'overwriteprotocol' => 'https', (no restart required).

1 Like