Skip to content

Commit

Permalink
Set Content-Type for PAC and WPAD file
Browse files Browse the repository at this point in the history
For Proxy Auto-Configuration (PAC) or Web Proxy Auto-Discovery (WPAD) to work correctly HTTP server needs to send "application/x-ns-proxy-autoconfig" Content-Type header. I've hardoced "proxy.pac" and "wpad.dat" because i am not golang coder and i dont know how to make it configurable. I hope somebody finds this usefull too and can make better PR.
  • Loading branch information
dafyk committed Jul 25, 2020
1 parent e795caa commit d3a46a6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/http_server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func (mod *HttpServer) Configure() error {

router.HandleFunc("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
mod.Debug("%s %s %s%s", tui.Bold(strings.Split(r.RemoteAddr, ":")[0]), r.Method, r.Host, r.URL.Path)
if r.URL.Path == "/proxy.pac" || r.URL.Path == "/wpad.dat" {
w.Header().Set("Content-Type", "application/x-ns-proxy-autoconfig")
}
fileServer.ServeHTTP(w, r)
}))

Expand Down

0 comments on commit d3a46a6

Please sign in to comment.