情况一:
重定向至某个页面,如index.html页面,但是url中的参数会丢失
使用error_page ,且 proxy_intercept_errors on;一定要配置
配置:
location / {
proxy_intercept_errors on;
proxy_pass http://upstream_1;
error_page 404 http://$server_name/index.html
}
情况二:
重定向需要把原来老的url中的参数也带入
如下图
使用nginx history模式 try_files
配置:
location / {
try_files $uri $uri/ /index.html;
proxy_pass http://upsteam_1;
}