0
我有一個簡單的go服務器在:8888
上偵聽。轉到:相對http.Redirect後面的Apache mod_proxy
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("redirecting to foo")
http.Redirect(w, r, "foo", http.StatusFound)
})
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("fooooo"))
})
if err := http.ListenAndServe(":8888", nil); err != nil {
log.Fatal(err)
}
}
我這個坐在後面的Apache其代理的圍棋服務器的所有請求/bar/*
。 我使用ProxyPassMatch
來做到這一點。
ProxyPassMatch ^/bar/?(:?(.*))?$ http://localhost:8888/$2
問題是,就是當我去/bar/
我重定向到/foo
而不是/bar/foo
有沒有辦法得到這個工作或做我需要/bar
前綴我的所有重定向?
我在'ProxyPassMatch'之後添加了'ProxyPassReverse'指令,它沒有什麼區別。我檢查了日誌,但找不到任何有用的東西。建議? –