Add nopath for vue things
This commit is contained in:
@@ -100,6 +100,17 @@ func (s *Server) Run() error {
|
||||
|
||||
func (s *Server) doAuth(foo http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
key := mapKey(r.Host)
|
||||
if config.GetCORS(key) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "X-Auth-Token, content-type, Content-Type")
|
||||
if r.Method == "OPTIONS" {
|
||||
w.Header().Set("Content-Length", "0")
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS, TRACE, PATCH, HEAD")
|
||||
return
|
||||
}
|
||||
}
|
||||
rusr, rpwd, ok := config.GetAuth()
|
||||
if ok {
|
||||
usr, pwd, ok := r.BasicAuth()
|
||||
@@ -109,7 +120,6 @@ func (s *Server) doAuth(foo http.HandlerFunc) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
}
|
||||
key := mapKey(r.Host)
|
||||
ok, err := s.lookupBOAuthZ(key)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
@@ -121,6 +131,9 @@ func (s *Server) doAuth(foo http.HandlerFunc) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
}
|
||||
if config.GetNoPath(key) {
|
||||
r.URL.Path = "/"
|
||||
}
|
||||
foo(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user