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!

  • Do you have any plugins/modules on your website which could be causing redirect loops? – ngn Jul 29 '15 at 9: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 9: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 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 9:15
  • This is happening on four different iPads, and clearing all data doesn't help. – Aleks G Jul 29 '15 at 9:16
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.

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.

  • This makes no sense at all - you are redirecting to itself – Aleks G Jul 29 '15 at 9:55
  • You're right, that didn't make sense. I have updated my answer, can you have a look at that? – ngn Jul 29 '15 at 10:06
  • This is exactly what I had in my original question. See my update in the question. – Aleks G Jul 29 '15 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.