URL地址带拼接参数的nginx转发配置
需求:
把外网的域名地址:http://xxx.xx.com.cn:8888/h5/h5SSOLogin.action?u=xxx&s=xxx
转发到内网地址:http://29.xx.xx.xx:8090/APPGateway/h5SSOLogin.action?u=xxx&s=xxx
实现:
由于外网地址url携带两个参数u和s,所以在配置nginx转发的时候需要把参数也传过来,在nginx server模块下增加location的配置,具体配置如下:
原理如下:当外网访问http://xxx.xx.com.cn:8888/h5/时,会代理转发到http://29.xx.xx.xx:8090/APPGateway/,外网后面的拼接参数会保持原样传给内网地址。