Disable Browser Caching for RAW view #6286

Closed
opened 2025-11-02 06:51:06 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @liszca on GitHub (Nov 10, 2020).

  • Gitea version (or commit ref):
  • Git version: 1.12.5
  • Operating system: Debian 10
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:

Description

Because of browser caching (in this case Firefox 82.0.2), the RAW file view may not represent the actual file content when Edit was done in browser beforehand.

The first screenshot shows what was saved, the second is Raw view.

It can be solved by clearing the cache of the browser, but is it possible to solve this on the server side?
...

Screenshots

grafik
grafik

Originally created by @liszca on GitHub (Nov 10, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): - Git version: 1.12.5 - Operating system: Debian 10 <!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package --> <!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. ---> <!-- If you are using a package or systemd tell us what distribution you are using --> - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ## Description Because of browser caching (in this case Firefox 82.0.2), the RAW file view may not represent the actual file content when Edit was done in browser beforehand. The first screenshot shows what was saved, the second is Raw view. It can be solved by clearing the cache of the browser, but is it possible to solve this on the server side? ... ## Screenshots ![grafik](https://user-images.githubusercontent.com/32976532/98706155-cc937780-237e-11eb-9d89-f663244f2862.png) ![grafik](https://user-images.githubusercontent.com/32976532/98706416-1bd9a800-237f-11eb-9b48-9027d8c0fa9a.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/proposal label 2025-11-02 06:51:06 -06:00
Author
Owner

@Codeberg-org commented on GitHub (Nov 22, 2020):

It might make sense to version these files with Etag, as we do in codeberg pages: https://codeberg.org/Codeberg/build-deploy-gitea/src/branch/master/var/www/pages/index.php#L146, so that they are cached, but the cache is invalidated with a new commit.

@Codeberg-org commented on GitHub (Nov 22, 2020): It might make sense to version these files with `Etag`, as we do in codeberg pages: https://codeberg.org/Codeberg/build-deploy-gitea/src/branch/master/var/www/pages/index.php#L146, so that they are cached, but the cache is invalidated with a new commit.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6286