Skip to content

proxy: unsupported upgrade fallback ignores backend headers #3456

@AlexanderYastrebov

Description

@AlexanderYastrebov

Whenever Skipper sees connection upgrade headers it assumes connection will be upgraded and when status is not 101 it tries to serve the backend response to the client.
In doing so it completely ignores backend response headers

skipper/proxy/upgrade.go

Lines 125 to 134 in c3b1657

if resp.StatusCode != http.StatusSwitchingProtocols {
log.Debugf("Got invalid status code from backend: %d", resp.StatusCode)
w.WriteHeader(resp.StatusCode)
_, err := io.Copy(w, resp.Body)
if err != nil {
log.Errorf("Error writing body to client: %s", err)
return
}
return
}

which results in Content-Type: text/plain; charset=utf-8, missing backend headers and Skipper branding

skipper/proxy/proxy.go

Lines 929 to 934 in c3b1657

// addBranding overwrites any existing `X-Powered-By` or `Server` header from headerMap
func addBranding(headerMap http.Header) {
if headerMap.Get("Server") == "" {
headerMap.Set("Server", "Skipper")
}
}

Tentatively this code path should reuse proxy code to serve a backend response.

See related HTTP/1.1 TLS Upgrade (RFC-2817) should not be default.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions