首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Apache2.4 ProxyPassMatch使用"-“

Apache2.4 ProxyPassMatch使用"-“
EN

Stack Overflow用户
提问于 2016-12-14 17:40:55
回答 1查看 367关注 0票数 0

我尝试在我的2本地主机之间创建一个代理通信。

我希望为从http://my-webapp.localhost/test-nc/mnm/resthttp://other.localhost/mnm/rest的所有uri创建一个代理。

这是我的代理配置

代码语言:javascript
运行
复制
    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

代码语言:javascript
运行
复制
    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中的"-“?

EN

回答 1

Stack Overflow用户

发布于 2016-12-15 08:00:49

一种解决方案是用重写程序替换proxypass。

RewriteRule /test-nc/mnm/rest/(.*) http://other.localhost/mnm/rest/$1 NE,P

但我无法为proxyPass找到任何解决方案

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41148844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档