Nginx doesn't redirect www no m in Safari, iPhone, iPad

ramsoft75 nginx-forum at nginx.us
Tue Jul 7 09:28:56 UTC 2015


Hi there all and thank's for the help

Dear oscaretu, the curl was tested with " doesn't help, because ! is a
special character it needs a escaope after "\", so the correct curl command
for the terminal is :

$ curl -A iPad -i http://www.domain.com/#\!/pt/--item-view/en/3190/Wok

Dear Francis Daly

For the initial configuration :

if ($http_user_agent ~* '(iPhone|iPod|iPad|Android|BlackBerry|webOS|Windows
Phone)') {
           rewrite ^ http://m.domain.com/$request_uri;
    }


For the example above the output in terminal is :

HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Tue, 07 Jul 2015 09:19:47 GMT
Content-Type: text/html
Content-Length: 154
Connection: keep-alive
Location: http://m.domain.com//

<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

It's the same if i changed to :

    if ($http_user_agent ~*
'(iPhone|iPod|iPad|Android|BlackBerry|webOS|Windows Phone)') {
           rewrite ^/$ http://m.domain.com/$request_uri;
    }

The problem is not from Nginx but from Safari witch doesn't send the url
after #, the Safari removes the fragment.

There are some documentation about this in :

http://randomproblems.com/parameter-passing-redirect-craziness-301-redirects-fragment-identifiers-hash-query-string-variables/
http://news.qooxdoo.org/http-redirects-and-loss-of-fragment-identifiers

The question know how to handle this # problem with Safari.

Thank's for the help

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260033,260110#msg-260110



More information about the nginx mailing list