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
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Sep 6, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels 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 added the type/enhancement An improvement of existing functionality label Sep 6, 2021
@6543 6543 merged commit 9fa6bdb into go-gitea:main Sep 6, 2021
@silverwind silverwind deleted the cache-ava-redirect branch September 6, 2021 21:48
@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.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants