Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for GetSourceScheme (0.21 sec)

  1. internal/handlers/proxy.go

    	// prefixed by 'proto='. The match is case-insensitive.
    	protoRegex = regexp.MustCompile(`(?i)^(;|,| )+(?:proto=)(https|http)`)
    )
    
    // GetSourceScheme retrieves the scheme from the X-Forwarded-Proto and RFC7239
    // Forwarded headers (in that order).
    func GetSourceScheme(r *http.Request) string {
    	var scheme string
    
    	// Retrieve the scheme from X-Forwarded-Proto.
    	if proto := r.Header.Get(xForwardedProto); proto != "" {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Dec 22 00:56:55 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  2. internal/handlers/proxy_test.go

    	}
    	for _, v := range headers {
    		req := &http.Request{
    			Header: http.Header{
    				v.key: []string{v.val},
    			},
    		}
    		res := GetSourceScheme(req)
    		if res != v.expected {
    			t.Errorf("wrong header for %s: got %s want %s", v.key, res,
    				v.expected)
    		}
    	}
    }
    
    // TestGetSourceIP - check the source ip of a request is parsed correctly.
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Dec 22 00:56:55 GMT 2023
    - 3.2K bytes
    - Viewed (0)
Back to top