on-internet
← Community

Nginx : detect mobile and forward to desktop

Stack Overflow ·

I have a problem i want to detect the domain and the device and forward the response to the desktop, www server section of nginx. With a rewrite this is done but the problem is the url, is cleared and substitute with my url, the configuration is the following : server { listen 80 default_server; #this detects any domain server_name ~^(www\.)?(?<domain>.+)$; root /home/someone/main; index index.html index.htm; set $mobile_rewrite do_not_perform; # this regex string is actually much longer to match more mobile devices if ($http_user_agent ~* '(iPhone|iPod|iPad|Android|BlackBerry|webOS|Windows Ph

Comments

Sign in or sign up to comment and upvote.

No comments yet.