3

Following a recent Ubuntu update, my local websites are no longer serving their pages over SSL. For example, my .htaccess file attempts to ensure /sign-in is always served over HTTPS:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /sign-in
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA,R=301]

However when I make a request to /sign-in on the domain site2-local , I get the error "The page isn't redirecting properly" with the following in /var/log/apache2/error.log

[Tue Jun 08 12:20:57 2010] [info] [client 127.0.1.1] Connection to child 0 established (server site1-local:443)
[Tue Jun 08 12:20:57 2010] [info] Seeding PRNG with 656 bytes of entropy
[Tue Jun 08 12:20:57 2010] [info] Initial (No.1) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.2) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.3) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.4) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.5) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.6) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.7) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.8) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.9) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:20:57 2010] [info] Subsequent (No.10) HTTPS request received for child 0 (server site2-local:443)
[Tue Jun 08 12:21:12 2010] [info] [client 127.0.1.1] (70007)The timeout specified has expired: SSL input filter read failed.
[Tue Jun 08 12:21:12 2010] [info] [client 127.0.1.1] Connection closed to child 0 with standard shutdown (server site2-local:443)

There is a connection to site1-local (another site on my machine which shares the certificate), which I don't understand.

Anyone know what is causing this issue?

3 Answers 3

2

I don't know what is causing the issue but I ran into it myself a while back and found a workaround of using a different variable to detect https requests.

You can use one of either %{SERVER_PORT} or %{SERVER_PROTOCOL}.

It also may be a capitalisation issue. %{HTTPS} may well be "Off" rather than "off".

In my SSL VirtualHosts, I have SetEnv HTTPS on which is a solution to a different problem I had but should solve your problem as well. The ultimate cause that required this solution was that the %{HTTPS} variable was not being set correctly. If your %{HTTPS} variable is not being set, setting it manually should solve the problem.

1
  • This solved the issue for me. Why would this not be set by default? Is there any downside to having this set?
    – nickspiel
    Nov 10, 2015 at 5:14
0

I think that HTTPS may not always be set when SSL is not turned on. So testing the port would indeed be a good solution (%{SERVER_PORT})

0

Let us make sure first if apache is listening on the https port: lsof -i:443 if you found no output then the problem is with the SSL module rather than the rewrite rule, specially since you say the same rule was working correctly before the upgrade.

Please also verify that running apache2ctl -t gives no errors or warnings

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .