The Wayback Machine - https://web.archive.org/web/20230113065948/https://github.com/go-gitea/gitea/pull/16973
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

Add Cache-Control to avatar redirects #16973

Merged
merged 3 commits into from Sep 6, 2021

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Sep 6, 2021

This does seem to do the trick to make the Avatar redirects cachable in Chrome.

In Firefox, it does not seem to work, thought and I found no way to suppress the requests to the original URLs, I even tried setting 301 or an Etag to no avail.

Related discussion in #16964.

This does seem to do the trick to make the Avatar redirects cachable
in Chrome.

In Firefox, it does not seem to work, thought and I found no way to
suppress the requests to the original URLs, I even tried setting an
Etag to no avail.

Related discussion in go-gitea#16964.
Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit but otherwise lgtm

routers/web/user/avatar.go Outdated Show resolved Hide resolved
axifive
axifive approved these changes Sep 6, 2021
routers/web/user/avatar.go Outdated Show resolved Hide resolved
routers/web/user/avatar.go Outdated Show resolved Hide resolved
routers/web/user/avatar.go Outdated Show resolved Hide resolved
routers/web/user/avatar.go Outdated Show resolved Hide resolved
@6543 6543 added this to the 1.16.0 milestone Sep 6, 2021
6543
6543 approved these changes Sep 6, 2021
@6543 6543 merged commit 9fa6bdb into go-gitea:main Sep 6, 2021
2 checks passed
@silverwind silverwind deleted the cache-ava-redirect branch Sep 6, 2021
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Sep 7, 2021

The default StaticCacheTime is pretty long (6 hours)

A user won't see his new avatar in 6 hours if he did a change ...... maybe he will submit a new issue saying "avatars not changed"

Is it good for end users?

@silverwind
Copy link
Member Author

We could shorten the default time a bit. Gravatar and GitHub use 5 minutes, for example.

@wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf
Copy link
Contributor

In Firefox, it does not seem to work...

it appears to work in my firefox (just a standard firefox developer edition) 🎉
have a look:
image

@silverwind
Copy link
Member Author

Nice. In my testing I could not get Firefox to cache the redirect for whatever reason, even tried a completely fresh profile.

@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

7 participants