mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-22 05:27:13 +02:00
proxy: remove csrf checks from proxied routes
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
923dca3fe1
commit
664fb8b0ea
1 changed files with 12 additions and 9 deletions
|
@ -25,21 +25,24 @@ func (p *Proxy) Handler() http.Handler {
|
|||
_, ok := p.routeConfigs[host]
|
||||
return ok
|
||||
}))
|
||||
r.Use(csrf.Protect(
|
||||
r.HandleFunc("/robots.txt", p.RobotsTxt)
|
||||
// requires authN not authZ
|
||||
r.Use(sessions.RetrieveSession(p.sessionStore))
|
||||
r.Use(p.VerifySession)
|
||||
// Proxy service endpoints
|
||||
v := r.PathPrefix("/.pomerium").Subrouter()
|
||||
v.Use(csrf.Protect(
|
||||
p.cookieSecret,
|
||||
csrf.Path("/"),
|
||||
csrf.Domain(p.cookieDomain),
|
||||
csrf.CookieName(fmt.Sprintf("%s_csrf", p.cookieName)),
|
||||
csrf.ErrorHandler(http.HandlerFunc(httputil.CSRFFailureHandler)),
|
||||
))
|
||||
r.HandleFunc("/robots.txt", p.RobotsTxt)
|
||||
// requires authN not authZ
|
||||
r.Use(sessions.RetrieveSession(p.sessionStore))
|
||||
r.Use(p.VerifySession)
|
||||
r.HandleFunc("/.pomerium/", p.UserDashboard).Methods(http.MethodGet)
|
||||
r.HandleFunc("/.pomerium/impersonate", p.Impersonate).Methods(http.MethodPost)
|
||||
r.HandleFunc("/.pomerium/sign_out", p.SignOut).Methods(http.MethodGet, http.MethodPost)
|
||||
r.HandleFunc("/.pomerium/refresh", p.ForceRefresh).Methods(http.MethodPost)
|
||||
v.HandleFunc("/", p.UserDashboard).Methods(http.MethodGet)
|
||||
v.HandleFunc("/impersonate", p.Impersonate).Methods(http.MethodPost)
|
||||
v.HandleFunc("/sign_out", p.SignOut).Methods(http.MethodGet, http.MethodPost)
|
||||
v.HandleFunc("/refresh", p.ForceRefresh).Methods(http.MethodPost)
|
||||
|
||||
r.PathPrefix("/").HandlerFunc(p.Proxy)
|
||||
return r
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue