如何在同一時間使用ProxyPass
和DirectoryIndex
?使用帶目錄索引的httpd ProxyPass
我有以下規則:
# Index
DirectoryIndex index.html
# Service Endpoint
ProxyPass /endpointA http://127.0.0.1:wxyz/
ProxyPassReverse /endpointA http://127.0.0.1:wxyz/
# Root Endpoint
ProxyPass/http://127.0.0.1:8080/static/
ProxyPassReverse/http://127.0.0.1:8080/static/
預期的行爲是,當用戶在/
打機,他們應服127.0.0.1:8080/static/index.html
我然而,我從/static/
得到一個404端點,因爲它沒有默認頁面試圖加載;這一切工作正常,如果我打
/index.html
哪些航線我127.0.0.1:8080/static/index.html
怎樣纔可以有一個的ProxyPass和DirectoryIndex的同時,或配置的一些其它組合的工作,所以,當用戶只需擊中
/
,他們被路由到127.0.0.1:8080/static/index.html
而不僅僅是127.0.0.1:8080/static
?
您的答案可能會導致混淆。 DirectoryIndex正在使用,index.html是本地或遠程沒有區別。 –
是否在備用服務器上使用DirectoryIndex?否則,對後臺服務器的請求將會失敗。 –
就是這樣,我已經說了這個部分,我添加了一個新的答案,以表明他可以做些什麼來避免/index.html被反向代理。 –