I have a simple go server listening on :8888
.
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)
}
}
I have this sitting behind apache which proxies all requests to /bar/*
to the go server.
I'm using ProxyPassMatch
to do this.
ProxyPassMatch ^/bar/?(:?(.*))?$ http://localhost:8888/$2
Problem is that is what when I go to /bar/
I get redirected to /foo
instead of /bar/foo
Is there a way to get this working or do I need to prefix all my redirects with /bar
?