![]() |
讲道义的高山 · Transformer in ...· 6 月前 · |
![]() |
性感的斑马 · 如何快速向kindle传送txt文件_百度知道· 7 月前 · |
![]() |
气势凌人的小刀 · DEAR XXX_百度百科· 7 月前 · |
![]() |
坚强的鸵鸟 · 功率因素校正(PFC)技术!· 8 月前 · |
![]() |
完美的红薯 · wait millis 60010, ...· 8 月前 · |
upstream apache {
server 127.0.0.1:8080;
server{
location ~* ^/service/(.*)$ {
proxy_pass http://apache/$1;
proxy_redirect off;
}
上面的代码片段会将url包含字符串"service“的请求重定向到另一个服务器,但不包含查询参数。
发布于 2013-07-25 21:48:28
我使用
~
而不是
~*
对kolbyjack的第二种方法进行了略微修改。
location ~ ^/service/ {
proxy_pass http://apache/$uri$is_args$args;
}
发布于 2016-05-24 15:30:40
您必须使用重写来使用proxy_pass传递参数。下面是我为s3部署angularjs应用程序所做的示例
S3 Static Website Hosting Route All Paths to Index.html
适应你的需求将会是这样的
location /service/ {
rewrite ^\/service\/(.*) /$1 break;
proxy_pass http://apache;
}
如果你想在 http://127.0.0.1:8080/query/params/ 中结束
如果你想在 http://127.0.0.1:8080/service/query/params/ 中结束,你需要类似这样的东西
location /service/ {