0
我的web栈由(nginx(port:29090) - > tomcat) nginx充当反向代理,和tomcat主机2 webapps
1.对于认证(使用netflix zuul) - 运行在端口29091
2. SensorThings API服务器 - 端口29101
这下面请求是使用zuul.route.sensor.url传递运行= http://localhost:29090/sensor-internal
Nginx重写带端口变化的正则表达式
下面是nginx.conf方框
location /sensor-internal/ {
include cors_support;
rewrite ^(/sensor/)(.*)$ SensorThingsServer-1.0/v1.0/$2 break;
proxy_redirect off;
proxy_set_header Host $host;
rewrite_log on;
}
我想更换URL
http://localhost:29090/sensor/xxxx(n)/yyyy(m)
到
http://localhost:29101/SensorThingsServer-1.0/v1.0/xxxx(n)/yyyy(m)
在港见变化和STS-1.0/1.0更换传感器/
我相信上面的块不会为端口变革而努力。请指导。
您可以将改写外块和块不会需要 –
技术上 - 是的,你可以把它移动到'server'上下文。但在这种情况下,该规则将测试对该服务器的每个请求 - 从我的角度来看,这会导致无用的CPU使用率。当你定义一个“位置”时,你清楚地指定了哪些URI根据这个重写规则进行验证。 –
感谢分享思考过程。请记住:-) –