I'm having the most weird thing happening with my web server. It's Apache 2 with SSL. To simplify, here's why my config looks like (example.com refers to my own domain, of course):
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect 301 / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/example
... #options and allow/deny for directories
... #logging settings
SSLEngine on
... #ssl settings
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
Redirect 301 / https://example.com/
SSLEngine on
... #ssl settings
</VirtualHost>
Essentially, what it does is redirect all non-https traffic to https and redirects www.example.com
to example.com
- so far, so good.
This works for all browsers on all platforms - with one exception: Safari on iPad. Safari on mac works fine; other browsers on ipad work fine, but on Safari on ipad I get "Safari cannot open the page because too many redirects occurred".
Now, the only redirect I have in my setup (on https) is from www.example.com to example.com. I added %{Host}i
to the access log - and I can see that the requests contain correct hostname and resource.
At this point I am completely stumped. I don't know where or what else to look at. My client mainly uses ipads, so ignoring it isn't an option.
Any ideas are greatly appreciated.
EDIT:
I changed the SSL configuration to this:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect 301 / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example
... #options and allow/deny for directories
... #logging settings
SSLEngine on
... #ssl settings
</VirtualHost>
Now there are no redirects in the config at all. I cleared all settings, history and stored data from the ipad - and it's still redirecting!
OK, +1 for the internet, -1 for Apple.
The culprit was
mod_spdy
on Apache 2.2. I don't know what or how or why, but disabling mod_spdy resolved the issue.I'm not too happy to leave it like this, but I don't have a choice for the time being.
Can you try this configuration on your server?
You can exclude the last VirtualHost block.