token-validator: don't prepend prefix when redirection are outside the site
This commit is contained in:
parent
e1f7027109
commit
3837513270
@ -27,7 +27,7 @@ func (r ResponseWriterPrefix) Header() http.Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r ResponseWriterPrefix) WriteHeader(s int) {
|
func (r ResponseWriterPrefix) WriteHeader(s int) {
|
||||||
if v, exists := r.real.Header()["Location"]; exists {
|
if v, exists := r.real.Header()["Location"]; exists && len(v) > 0 && !strings.HasPrefix(v[0], "https://") && !strings.HasPrefix(v[0], "http://") {
|
||||||
r.real.Header().Set("Location", r.prefix+v[0])
|
r.real.Header().Set("Location", r.prefix+v[0])
|
||||||
}
|
}
|
||||||
r.real.WriteHeader(s)
|
r.real.WriteHeader(s)
|
||||||
|
Reference in New Issue
Block a user