mirror of
https://github.com/harness/drone.git
synced 2025-05-03 14:59:42 +08:00
support fowarded for header as well
This commit is contained in:
parent
db3bd3b2cd
commit
77a799a4c9
@ -17,6 +17,7 @@ package account
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/harness/gitness/types"
|
"github.com/harness/gitness/types"
|
||||||
@ -53,7 +54,12 @@ func deleteTokenCookieIfPresent(r *http.Request, w http.ResponseWriter, cookieNa
|
|||||||
|
|
||||||
func newEmptyTokenCookie(r *http.Request, cookieName string) *http.Cookie {
|
func newEmptyTokenCookie(r *http.Request, cookieName string) *http.Cookie {
|
||||||
domain := r.URL.Hostname()
|
domain := r.URL.Hostname()
|
||||||
if headers, ok := r.Header["X-Forwarded-For"]; ok && len(headers) > 0 {
|
if urls, ok := r.Header["X-Forwarded-For"]; ok && len(urls) > 0 {
|
||||||
|
if url, err := url.Parse(urls[0]); err != nil {
|
||||||
|
domain = url.Hostname()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if headers, ok := r.Header["X-Forwarded-Header"]; ok && len(headers) > 0 {
|
||||||
domain = headers[0]
|
domain = headers[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user