We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server { listen 1024; #server_name localhost; 正向代理不要设置server_name resolver 114.114.114.114 valid=600s; #指定DNS服务器IP地址 proxy_connect_timeout 5s; proxy_read_timeout 150s; proxy_send_timeout 150s; #规则1, 正向代理 location / { proxy_pass http://$host$request_uri; #设定代理服务器的协议和地址 } #规则2 location /api/ { proxy_pass http://www.demo.com/api/; } }
假设 server ip: 10.10.0.10 // 无代理时的请求,remote-address由dns解析得到 GET http://www.demo.com/api/product/list HOST www.demo.com Remote-Address 112.80.248.76:80
// 请求时添加了proxy,会走到规则2【推荐】 GET http://www.demo.com/api/product/list HOST www.demo.com Remote-Address 10.10.0.10:80
// 请求时直接替换了URL的域名, 会走到规则2【不推荐】 GET http://10.10.0.10/api/product/list HOST 10.10.0.10 Remote-Address 10.10.0.10:80
The text was updated successfully, but these errors were encountered:
No branches or pull requests
nginx 转发配置
假设 server ip: 10.10.0.10
// 无代理时的请求,remote-address由dns解析得到
GET http://www.demo.com/api/product/list
HOST www.demo.com
Remote-Address 112.80.248.76:80
// 请求时添加了proxy,会走到规则2【推荐】
GET http://www.demo.com/api/product/list
HOST www.demo.com
Remote-Address 10.10.0.10:80
// 请求时直接替换了URL的域名, 会走到规则2【不推荐】
GET http://10.10.0.10/api/product/list
HOST 10.10.0.10
Remote-Address 10.10.0.10:80
The text was updated successfully, but these errors were encountered: