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

Francis Daly francis at daoine.org
Mon Jul 6 18:20:36 UTC 2015


On Mon, Jul 06, 2015 at 12:40:37PM -0400, ramsoft75 wrote:

Hi there,

Things seem to be getting a lot more complicated than they need to.

> The "^/$" came from :
> 
> #to detect if the device with www entered in domain is mobile
> if ($http_user_agent ~* '(iPhone|iPod|iPad|Android|BlackBerry|webOS|Windows
> Phone)') {
>   rewrite ^/$ http://m.domain.com$request_uri;
> }

That's not the configuration you started with.

You indicated that with your starting configuration, some requests did
get the response that you wanted, and some did not.

I have been unable to reproduce the "did not" case; probably because I
do not fully understand what your expectations are.

Can you go back to your starting configuration, and do whatever it takes
to get the "ok" request/response, and then show the access_log entry
for that request?

(Or just find the old log file.)

The log line should show a GET going to the "www" server, with a response
code of 302. Ideally, it will also show the user-agent involved.

Then can you show the log line corresponding to a "not ok"
request/response? It should also show a GET going to the "www" server,
with a response code of 302, if I have understood correctly what you
have reported.

Comparing the two log lines, particularly the request and the user-agent,
may show why the "not ok" one responded as it did.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list