Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
301 Redirect on Avatars #113
Hi, Aaron! Thank you for webmention.io - I use it all day, everyday.
Slight request: would you consider changing the redirect (from webmention.io/avatars to s3) a 301 permanent redirect rather than a 302 redirect?
This would help caching on all of our sites and ease up on webmention.io requests as well. With a 302 redirect, the browser can cache the image served by S3 - but it can't cache the redirect. With a 301 redirect, the browser can cache both.
I realize a permanent redirect sounds scary - however, you are already using hash digests in your URLs. If the image changes, the URL will change and the cache will expire. And if you move your S3 bucket somewhere else, that's fine too - the browsers out there that don't have the image will find the new location and the images out there that are cached will stay cached.
I would submit a pull request, but there is no reference to the /avatars controller in your code, so I imagine it is being done by an HTTP server configuration. In the case of nginx, it's a matter of using 'permanent' at the end of the 'rewrite' command:
Ok, that's all. Thank you!