klarna and checkouts
This commit is contained in:
@@ -21,6 +21,19 @@ func getOriginalHost(r *http.Request) string {
|
||||
return r.Host
|
||||
}
|
||||
|
||||
// getScheme resolves the public scheme for building absolute URLs (e.g. Klarna
|
||||
// merchant_urls). Honors X-Forwarded-Proto set by the edge/dev proxy; defaults
|
||||
// to https so production (TLS terminated at nginx/ingress, no header) is correct.
|
||||
func getScheme(r *http.Request) string {
|
||||
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
|
||||
return proto
|
||||
}
|
||||
if r.TLS != nil {
|
||||
return "https"
|
||||
}
|
||||
return "https"
|
||||
}
|
||||
|
||||
func getClientIp(r *http.Request) string {
|
||||
ip := r.Header.Get("X-Forwarded-For")
|
||||
if ip == "" {
|
||||
|
||||
Reference in New Issue
Block a user