Feed returns incorrect 301 Location header
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 https://github.com/sky-uk/feed/blob/319130ef7cd59301b61651174c6107e0556a3073/nginx/nginx.tmpl#L161 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.
Is it possible to override 8080 w/ the correct port?
That could work. The commandline args would just need to change to match the ELB ports and to check if the ingress is wanting https or not.
https://github.com/sky-uk/feed/blob/319130ef7cd59301b61651174c6107e0556a3073/nginx/nginx.tmpl#L150
A little harder than that probably, since you won't be able to bind to 80/443 by default without setting capabilities.