hostname/DOMAIN used as subpath in templates somehow? #2322

Closed
opened 2025-11-02 04:32:47 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @ghost on GitHub (Sep 12, 2018).

  • Gitea version (or commit ref): docker - gitea/gitea:latest
  • Git version:
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant (deals with custom config)
  • Log gist:
gitea_1       | [Macaron] 2018-09-12 04:24:44: Started GET / for 172.68.143.94
gitea_1       | [Macaron] 2018-09-12 04:24:44: Completed GET / 200 OK in 3.83089ms
gitea_1       | [Macaron] 2018-09-12 04:24:45: Started GET /git.me.host/vendor/assets/octicons/octicons.min.css for 172.68.143.94
gitea_1       | [Macaron] 2018-09-12 04:24:45: Completed GET /git.me.host/vendor/assets/octicons/octicons.min.css 404 Not Found in 4.221723ms
gitea_1      

Description

Gitea seems to be using the hostname (defined in ini as DOMAIN) to decide on the addresses for templates as a suburl, when used behind Traefik. I'm unsure if this is still the trailing slash issue
encountered on nginx.

Based on the separated templates (using the AppSubUrl variable in templates/base.tmpl) from 5 days ago, maybe it's just that it's broken there?

Or maybe it's still just that gitea acts weird around trailing slashes (...why... does it still do this?) 😢

why would it gobble domain into the templates?

Originally created by @ghost on GitHub (Sep 12, 2018). - Gitea version (or commit ref): docker - gitea/gitea:latest - Git version: - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant (deals with custom config) - Log gist: ``` gitea_1 | [Macaron] 2018-09-12 04:24:44: Started GET / for 172.68.143.94 gitea_1 | [Macaron] 2018-09-12 04:24:44: Completed GET / 200 OK in 3.83089ms gitea_1 | [Macaron] 2018-09-12 04:24:45: Started GET /git.me.host/vendor/assets/octicons/octicons.min.css for 172.68.143.94 gitea_1 | [Macaron] 2018-09-12 04:24:45: Completed GET /git.me.host/vendor/assets/octicons/octicons.min.css 404 Not Found in 4.221723ms gitea_1 ``` ## Description Gitea seems to be using the hostname (defined in ini as DOMAIN) to decide on the addresses for templates as a suburl, when used behind Traefik. I'm unsure if this is still the trailing slash issue encountered on nginx. Based on the separated templates (using the AppSubUrl variable in templates/base.tmpl) from 5 days ago, maybe it's just that it's broken there? Or maybe it's still just that gitea acts weird around trailing slashes (...why... does it still do this?) :cry: why would it gobble domain into the templates?
GiteaMirror added the issue/confirmed label 2025-11-02 04:32:47 -06:00
Author
Owner

@lafriks commented on GitHub (Sep 12, 2018):

Can you provide parts of app.ini about domain/subpath/appurl?

@lafriks commented on GitHub (Sep 12, 2018): Can you provide parts of app.ini about domain/subpath/appurl?
Author
Owner

@ghost commented on GitHub (Sep 12, 2018):

used the example ini, changing the domain and setting DB type to sqlite.

[server]
; The protocol the server listens on. One of 'http', 'https', 'unix' or 'fcgi'.
PROTOCOL = http
DOMAIN = git.me.host
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
; The address to listen on. Either a IPv4/IPv6 address or the path to a unix socket.
HTTP_ADDR = 0.0.0.0
HTTP_PORT = 3000

...

DB_Type=sqlite3


@ghost commented on GitHub (Sep 12, 2018): used the example ini, changing the domain and setting DB type to sqlite. ``` [server] ; The protocol the server listens on. One of 'http', 'https', 'unix' or 'fcgi'. PROTOCOL = http DOMAIN = git.me.host ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/ ; The address to listen on. Either a IPv4/IPv6 address or the path to a unix socket. HTTP_ADDR = 0.0.0.0 HTTP_PORT = 3000 ... DB_Type=sqlite3 ```
Author
Owner

@lafriks commented on GitHub (Sep 12, 2018):

app.ini looks good. Can you check what paths are in rendered html when you view source from browser when opening page?

@lafriks commented on GitHub (Sep 12, 2018): app.ini looks good. Can you check what paths are in rendered html when you view source from browser when opening page?
Author
Owner

@ghost commented on GitHub (Sep 12, 2018):

<link rel="stylesheet" href="git.me.host/vendor/plugins/semantic/semantic.min.css">
	<link rel="stylesheet" href="git.me.host/css/index.css?v=69c0cd75067b7801ae667465a9ee03c3">
@ghost commented on GitHub (Sep 12, 2018): ``` <link rel="stylesheet" href="git.me.host/vendor/plugins/semantic/semantic.min.css"> <link rel="stylesheet" href="git.me.host/css/index.css?v=69c0cd75067b7801ae667465a9ee03c3"> ```
Author
Owner

@ghost commented on GitHub (Sep 12, 2018):

could just be templating not prefixing the url with /? or should that be in the config, prefixed there?

@ghost commented on GitHub (Sep 12, 2018): could just be templating not prefixing the url with /? or should that be in the config, prefixed there?
Author
Owner

@ghost commented on GitHub (Sep 12, 2018):

(ref="domain/assets" instead of, i.e. "https://domain/assets", or "/domain/assets")

@ghost commented on GitHub (Sep 12, 2018): (ref="domain/assets" instead of, i.e. "https://domain/assets", or "/domain/assets")
Author
Owner

@lafriks commented on GitHub (Sep 12, 2018):

It should not include domain part at all

@lafriks commented on GitHub (Sep 12, 2018): It should not include domain part at all
Author
Owner

@ghost commented on GitHub (Sep 12, 2018):

I'm headed off to bed. Thank you @lafriks for helping out so far :)

@ghost commented on GitHub (Sep 12, 2018): I'm headed off to bed. Thank you @lafriks for helping out so far :)
Author
Owner

@stale[bot] commented on GitHub (Jan 10, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 10, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@ghost commented on GitHub (Jan 10, 2019):

I'll check to see if this issue still exists...

@ghost commented on GitHub (Jan 10, 2019): I'll check to see if this issue still exists...
Author
Owner

@stale[bot] commented on GitHub (Mar 11, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Mar 11, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@mrsdizzie commented on GitHub (Sep 8, 2020):

Does not seem reproducible in current version

@mrsdizzie commented on GitHub (Sep 8, 2020): Does not seem reproducible in current version
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2322