Ssl – HTTPS doesn’t work anymore after adding SSLRequireSSL directive

.htaccessapache-2.4mac-osx-serverssl

I have a Mac Mini Server, running macOS Sierra (10.12.2) with macOS Server (5.2). This comes with a built-in Apache server, which is set up to listen on ports 80 and 443. This works fine; documents are accessible over both HTTP and HTTPS.

However, as soon as I use the SSLRequireSSL directive in the .htaccess file, it stops working. In the browser, when accessing https://www.example.com/path/document, I see the following:

Forbidden

You don't have permission to access /path/document on this server.


Apache Server at www.example.com Port 80

Note that the error message mentions port 80, even though it is served over HTTPS / port 443 (I checked this with curl – so browser redirects aren't an issue here). But this could be related to the source of the problem.

In the Apache error log, the following is shown:

[Sun Jan 29 16:38:07.674342 2017] [ssl:error] [pid 82204] [client 127.0.0.1:50195] AH02219: access to /Users/Glorfindel/wwwroot/path/document failed, reason: SSL connection required

Other directives in the .htaccess file do work (e.g. Options -Indexes).

Best Answer

You are not accessing https.

The error you are showing clearly says: "Apache Server at www.example.com Port 80"

Make sure you really access https, make sure there are not redirects that send you to http (using your browsers web console for example).

Based on your comments, here is a tip to see what is happening:

curl -I https://www.example.com/path/document

This will show you an uncached answer from your server, if you have access or not, and/or if you are getting a redirection to http.

Related Topic