Go:ApacheModu代理后的相对http.Redirect

Go:ApacheModu代理后的相对http.Redirect,apache,go,mod-proxy,Apache,Go,Mod Proxy,我有一个简单的go服务器,正在收听: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) })

我有一个简单的go服务器,正在收听
: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)
  }
}
我有一个apache,它将所有对
/bar/*
的请求代理给go服务器。 我正在使用
ProxyPassMatch
来执行此操作

 ProxyPassMatch ^/bar/?(:?(.*))?$ http://localhost:8888/$2
问题是,当我转到
/bar/
时,我会被重定向到
/foo
,而不是
/bar/foo


是否有办法使其正常工作,或者是否需要在所有重定向前加上
/bar

如果希望Apache重写重定向响应中的位置,还需要在配置中包含该指令。像这样的事情应该可以做到:

ProxyPassReverse /bar/ http://localhost:8888/

我在
ProxyPassMatch
之后添加了
ProxyPassReverse
指令,但这并没有什么区别。我查看了日志,但没有找到任何有用的东西。建议?