Nginx 前后端分离,前端手机端与PC端分离
作者:互联网
前后端分离,前端手机端与PC端分离
server { listen 8080; server_name localhost 127.0.0.1; #添加头部信息 proxy_set_header Cookie $http_cookie; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #add_header Cache-Control no-cache; location /api { rewrite /api/(.*) /$1 break; proxy_pass http://localhost:9090; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; #重点重定向会导致oAuth2找不到正确的重定向地址 } location / { #rewrite /ui/(.*) /$1 break; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; #重点重定向会导致oAuth2找不到正确的重定向地址 if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) { proxy_pass http://localhost:4535; break; } proxy_pass http://localhost:4534; } }
标签:set,Forwarded,Nginx,header,分离,Host,PC,host,proxy 来源: https://www.cnblogs.com/xiaoruilin/p/16391492.html