簡體   English   中英

apache 2.4 ProxyPassMatch使用“-”

[英]apache 2.4 ProxyPassMatch use “-”

我已經嘗試在我的2個localhost主機之間創建代理通信

我想為從http://my-webapp.localhost/test-nc/mnm/resthttp://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中使用其他不帶“-”(破折號)的test-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

如何在代理配置中的網址內正確使用“-”?

一種解決方案是用重寫器替換proxypass

重寫規則/test-nc/mnm/rest/(.*) 的http://other.localhost/mnm/rest/ 1 $ [NE,P],

但我找不到proxyPass的任何解決方案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM