Skip to content

Feed returns incorrect 301 Location header #192

Open
@shin-nien

Description

For any ingress that uses a non / path e.g. /myapp, trying to hit http://<host>/myapp results in a 301 with an incorrect Location header. Hitting /myapp/ hits the backend as expected.

HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Date: Fri, 14 Dec 2018 12:11:47 GMT
Location: http://shin-test-ingress.<domain>:8080/myapp/
Server: nginx
Content-Length: 178
Connection: keep-alive

The 8080 is the port nginx is configured to listen to rather than the listening port of the ELB.

Arguably, hitting /myapp shouldn't be issuing a redirect at all; it's the implementation of

location {{ if $location.Path }}{{ $location.Path }}{{ end }} {
that appends a trailing / presumably because prefix matching was preferred but then users of feed had to adhere to calling the endpoints with a trailing /.

My guess is that it's failing to find an exact match so it fallbacks to an approximate match, finds it but then thinks it should issue a 301 to the path it's found.

Historically, most endpoints in feed have been APIs and this was only noticed when someone tried to use a path with a website and a browser although in practise, we tend to just use / as the path if we're fronting Grafana, Jenkins etc.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions