簡體   English   中英

Apache反向代理:(保持現有路由有效)

[英]Apache Reverse Proxy: (Keeping Existing route alive)

我有一個在localhost:3000上運行的應用程序。 我還有另一個配置為在virtualhost local.testserver.com上運行的應用程序

我想創建一個Apache反向代理,它將所有請求從local.testserver.com/finance路由到運行在localhost:3000的應用程序。 同時,當我轉到localhost:3000時,我希望能夠訪問我的應用程序。

以下是我當前使用的配置。 這適用於將請求從local.testserver.com/finance路由到我的localhost:3000應用程序。 但是,每當我直接訪問localhost:3000時 ,它就會將我重定向回local.testserver.com

<Location /finance >
    ProxyPass http://localhost:3000
    ProxyPassReverse http://localhost:3000
</Location>

您將需要在ProxyPassReverse設置上將路徑添加到“ / finance”,以便它知道在哪里將請求回退。

您可能不需要<Location /finance>...</Location>部分

ProxyPass "/finance" http://localhost:3000
ProxyPassReverse "/finance" "http://localhost:3000"

請參考文檔以更好地了解ProxyPassReverse的工作原理:

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassreverse

暫無
暫無

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

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