基于User-Agent控制
location / { if ($http_user_agent ~* "(mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)") { add_header X-Frame-Options SAMEORIGIN; proxy_pass 手机端uri; } }
根据location+User_agent控制
server{ listen 4104; server_name localhost; location /h5/ { if ($http_user_agent ~* "(mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)") { add_header X-Frame-Options SAMEORIGIN; proxy_pass http://10.24.61.41:4100; } } location /gmtlogin { proxy_pass http://10.24.61.41:4100; } location ^~ / { deny all; } }