1.16.0 "View file" is missing line menu, but is there on try.gitea.io #8449

Closed
opened 2025-11-02 08:06:23 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @flozzone on GitHub (Feb 1, 2022).

Gitea Version

1.16.0

Git Version

2.30.2

Operating System

Centos 7

How are you running Gitea?

Deployed with Ansible as a plain docker container with second container running Apache as proxy to serve Gitea as HTTPS. The Gitea container is built from the official container at docker hub gitea/gitea:1.16.0. It is just rebuilt to provide SSL certificates for our SSO.

Dockerfile:

FROM gitea/gitea:{{ gitea_version }}
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
COPY ./sso.pem /usr/local/share/ca-certificates/sso.pem
RUN update-ca-certificates

Database

PostgreSQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

Since I've upgraded to 1.16.0 the line anchors in the raw view of a file are missing. So clicking on a line number does nothing. When I counter-checked this on try.gitea.io, I could see that it works there. So the first thing that came in my mind, was that the proxy would be caching an older version, but because the javascript URL contains a version number it should automatically invalidate any cached file. Nevertheless I've restarted the proxy, but without success.

Since this cannot be reproduced on try.gitea.io, I am pretty sure this has something to do with my setup. The apache config is aligned to the one in the docs at https://docs.gitea.io/en-us/reverse-proxies/

<VirtualHost *:443>
    SSLEngine On

    Protocols h2 h2c http/1.1

    SSLCertificateFile /etc/gitea-cert/gitea.cert
    SSLCertificateKeyFile /etc/gitea-cert/gitea.key
    SSLCertificateChainFile /etc/gitea-cert/gitea-chain.cert

    RequestHeader set X-Forwarded-Proto 'https'

    ProxyPreserveHost On
    ProxyRequests Off
    AllowEncodedSlashes NoDecode

    ProxyPass / http://gitea:3000/ nocanon
</VirtualHost>

Side-note: Is the doc missing the part with Protocols h2 h2c http/1.1? I remember HTTP/2 is needed for server push on some pages.

When I try to pass an anchor to a view file URL by appending #L1, it does nothing. Is it entirely handled by JS?

No special Gitea HTML templates are defined.

Do you have any suggestion or hint?

Screenshots

Line menu on try.gitea.io at dfe059d3d4/file.txt (L1)

image

No line menu on our installation:

image

Originally created by @flozzone on GitHub (Feb 1, 2022). ### Gitea Version 1.16.0 ### Git Version 2.30.2 ### Operating System Centos 7 ### How are you running Gitea? Deployed with Ansible as a plain docker container with second container running Apache as proxy to serve Gitea as HTTPS. The Gitea container is built from the official container at docker hub `gitea/gitea:1.16.0`. It is just rebuilt to provide SSL certificates for our SSO. Dockerfile: ``` FROM gitea/gitea:{{ gitea_version }} RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* COPY ./sso.pem /usr/local/share/ca-certificates/sso.pem RUN update-ca-certificates ``` ### Database PostgreSQL ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description Since I've upgraded to 1.16.0 the line anchors in the raw view of a file are missing. So clicking on a line number does nothing. When I counter-checked this on try.gitea.io, I could see that it works there. So the first thing that came in my mind, was that the proxy would be caching an older version, but because the javascript URL contains a version number it should automatically invalidate any cached file. Nevertheless I've restarted the proxy, but without success. Since this cannot be reproduced on try.gitea.io, I am pretty sure this has something to do with my setup. The apache config is aligned to the one in the docs at https://docs.gitea.io/en-us/reverse-proxies/ ``` <VirtualHost *:443> SSLEngine On Protocols h2 h2c http/1.1 SSLCertificateFile /etc/gitea-cert/gitea.cert SSLCertificateKeyFile /etc/gitea-cert/gitea.key SSLCertificateChainFile /etc/gitea-cert/gitea-chain.cert RequestHeader set X-Forwarded-Proto 'https' ProxyPreserveHost On ProxyRequests Off AllowEncodedSlashes NoDecode ProxyPass / http://gitea:3000/ nocanon </VirtualHost> ``` Side-note: Is the doc missing the part with `Protocols h2 h2c http/1.1`? I remember HTTP/2 is needed for server push on some pages. When I try to pass an anchor to a view file URL by appending `#L1`, it does nothing. Is it entirely handled by JS? No special Gitea HTML templates are defined. Do you have any suggestion or hint? ### Screenshots Line menu on try.gitea.io at https://try.gitea.io/company-org/custom-project/src/commit/dfe059d3d4e732b10a3b8d8e64f874e4c74a0e99/file.txt#L1 ![image](https://user-images.githubusercontent.com/1153549/151932889-4aa8f46b-6d20-476c-991a-74e714a42c8f.png) No line menu on our installation: ![image](https://user-images.githubusercontent.com/1153549/151932976-f6db4f2f-1b91-40af-9057-34801d21ef72.png)
Author
Owner

@flozzone commented on GitHub (Feb 2, 2022):

Do you have any explanation, why I wasn't able to reproduce this on try.gitea.io?

@flozzone commented on GitHub (Feb 2, 2022): Do you have any explanation, why I wasn't able to reproduce this on try.gitea.io?
Author
Owner

@flozzone commented on GitHub (Feb 3, 2022):

After testing this again today, it just worked. Seems its a caching issue and we just run out of TTL. Has the version in https://out-git-host/assets/js/index.js?v=63283ac5ef3618dbfa5fcf82866ca1ea been correctly updated with the upgrade? Do you see any problems in my Apache config that would cause stripped URL parameters for that JS asset? Or are these assets somehow pulled from a remote and you've just fixed it?

@flozzone commented on GitHub (Feb 3, 2022): After testing this again today, it just worked. Seems its a caching issue and we just run out of TTL. Has the version in `https://out-git-host/assets/js/index.js?v=63283ac5ef3618dbfa5fcf82866ca1ea` been correctly updated with the upgrade? Do you see any problems in my Apache config that would cause stripped URL parameters for that JS asset? Or are these assets somehow pulled from a remote and you've just fixed it?
Author
Owner

@zeripath commented on GitHub (Feb 3, 2022):

yeah it's a caching bug that commonly occurs. I'm gonna close this issue.

@zeripath commented on GitHub (Feb 3, 2022): yeah it's a caching bug that commonly occurs. I'm gonna close this issue.
Author
Owner

@flozzone commented on GitHub (Feb 4, 2022):

ok thanks, I will just wait the next time after upgrading.

@flozzone commented on GitHub (Feb 4, 2022): ok thanks, I will just wait the next time after upgrading.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8449