1

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!

Aleks G
  • 751
  • 2
  • 6
  • 18
  • Do you have any plugins/modules on your website which could be causing redirect loops? – ngn Jul 29 '15 at 09:08
  • If it were caused by modules, it would affect all browsers and platforms. This is specifically only affecting iPad safari. – Aleks G Jul 29 '15 at 09:11
  • I am not sure if you are seeing this behaviour on multiple iPad's or just on your test device. If you have tested only on one device, I would recommend you go through [this](https://support.apple.com/en-gb/HT203370) knowledgebase article. If there is nothing wrong with your configuration, clearing website data in Safari and retrying might solve your problem. – ngn Jul 29 '15 at 09:15
  • This is happening on four different iPads, and clearing all data doesn't help. – Aleks G Jul 29 '15 at 09:16

2 Answers2

2

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.

Aleks G
  • 751
  • 2
  • 6
  • 18
0

Can you try this configuration on your server?

<VirtualHost *:443>

    ServerName www.example.com
    ServerAlias *.example.com
    Redirect 301 / example.com/

    DocumentRoot /var/www/example

... #options and allow/deny for directories

... #logging settings

SSLEngine on
... #ssl settings

</VirtualHost>

You can exclude the last VirtualHost block.

ngn
  • 333
  • 1
  • 10