Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

301 Redirect on Avatars #113

Closed
kickscondor opened this issue Aug 24, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@kickscondor
Copy link

commented Aug 24, 2018

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:

rewrite ^/oldlocation$ http://www.newdomain.com/newlocation permanent;

Ok, that's all. Thank you!

@aaronpk

This comment has been minimized.

Copy link
Owner

commented Jun 16, 2019

Ok, I've switched this to a permanent redirect. I think I see the browser caching working now too.

@aaronpk aaronpk closed this Jun 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.