我尝试在我的2本地主机之间创建一个代理通信。
我希望为从http://my-webapp.localhost/test-nc/mnm/rest到http://other.localhost/mnm/rest的所有uri创建一个代理。
这是我的代理配置
ProxyPass /test-nc/mnm/rest http://other.localhost/mnm/rest
ProxyPassReverse /test-nc/mnm/rest http://other.localhost/mnm/rest
Header add "Access-Control-Allow-Origin" "*"
ProxyPassMatch ^/test\-nc/mnm/rest/(.*) http://other.localhost/mnm/rest/$1这不起作用,但如果在uri中使用其他测试-nc,而不使用"-“(破折号),效果很好。
这项工作(但我必须使用test-nc)
从http://my-webapp.localhost/testnc/mnm/rest/aa/1/as2serverrules呼叫http://other.localhost/mnm/rest/aa/1/as2serverrules
ProxyPass /testnc/mnm/rest http://other.localhost/mnm/rest
ProxyPassReverse /testnc/mnm/rest http://other.localhost/mnm/rest
Header add "Access-Control-Allow-Origin" "*"
ProxyPassMatch ^/testnc/mnm/rest/(.*) http://other.localhost/mnm/rest/$1如何正确使用代理配置中url中的"-“?
发布于 2016-12-15 08:00:49
一种解决方案是用重写程序替换proxypass。
RewriteRule /test-nc/mnm/rest/(.*) http://other.localhost/mnm/rest/$1 NE,P
但我无法为proxyPass找到任何解决方案
https://stackoverflow.com/questions/41148844
复制相似问题