我需要代理请求从我的服务器到另一个两个选项应该实现
第一:
从https://my-site.com/subjects/custom_id到https://another-site.com/subjects/custom_id
示例:
https://my-site.com/subjects/1到https://another-site.com/subjects/1
https://my-site.com/subjects/2到https://another-site.com/subjects/2
Nginx配置(工作正常):
location ~ ^/subjects/?(.*) {
resolver 8.8.8.8;
proxy_pass https://another-site.com/subjects/$1$is_args$args;
}
第二:
从https://my-site.com/subjects?code=custom_code到https://another-site.com/subjects?code=custom_code
示例:
https://my-site.com/subjects?code=1到https://another-site.com/subjects?code=1
https://my-site.com/subjects?code=2到https://another-site.com/subjects?code=2
如何为这种情况编写Nginx配置?
1条答案
按热度按时间lokaqttq1#
固定: