ubuntu.com icon indicating copy to clipboard operation
ubuntu.com copied to clipboard

inefficient redirect chain from https://blog.ubuntu.com/

Open vmpjdc opened this issue 2 years ago • 1 comments

Note - filling in this form will file an issue against the www.ubuntu.com website, not against Ubuntu itself, for Ubuntu bugs, please go here

Summary

I noticed that visiting https://blog.ubuntu.com/ results in an extra redirect, like so:

https://blog.ubuntu.com/ --> https://ubuntu.com/blog/ --> https://ubuntu.com/blog

I'm not sure how popular this entrypoint is, but IS is certainly monitoring it! And of course the extra request makes the final location slower to load.

Also, the second redirect is sent as a 302 (temporary redirect), so it cannot be cached.

Process

Something like this gives an idea of the HTTP requests and responses involved:

$ curl -L -sv https://blog.ubuntu.com/ -o /dev/null |& grep -E 'HTTP/|location:'
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
> GET / HTTP/2
< HTTP/2 301
< location: https://ubuntu.com/blog/
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
> GET /blog/ HTTP/2
< HTTP/2 302
< location: https://ubuntu.com/blog
> GET /blog HTTP/2
< HTTP/2 200
$ _

Current and expected result

Expected to be sent to the current location of the Ubuntu Blog with a single redirect.

Was actually sent via an additional location to be redirected to the final location.

Screenshot

N/A

Browser details

Observed with curl, should affect all browsers.

vmpjdc avatar Jul 09 '23 22:07 vmpjdc

This is because of the way our nginx conf snippets are set up, it adds the trailing / in the second request by default. Agreed that the extra redirect isn't useful, will investigate a clean fix

mtruj013 avatar Jul 30 '25 14:07 mtruj013