docker: preview for *.md-files failes in some scenarios (ROOT_URL get's not resolved/accessed properly) #5694

Closed
opened 2025-11-02 06:33:23 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @fragment86 on GitHub (Jul 5, 2020).

  • Gitea version (or commit ref): docker image with tag "1.12.1" / docker image with tag: "latest" (currently 1.13.0+dev)
  • Git version: 2.24.3 / 2.26.2
  • Operating system: ubuntu 20.04, docker: 19.03.8, build afacb8b7f0
  • Browser: Firefox 78.0.1
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

preview for *.md-files failes ("Loading..." appears forever) when access url doesn't match ROOT_URL ('localhost' vs. IP vs. hostname). I tried the following settings:

Scenario 1:
ROOT_URL = http://localhost:3000/
access-URL in browser: http://localhost:3000/, local machine: ok, preview is displayed
access URL in browser: http://192.168.123.45:3000/, local machine: failed, message: "Loading..."
access URL in browser: http://192.168.123.45:3000/, remote machine: failed, message: "Loading..."
access URL in browser: http://hostname:3000/, local machine: failed, message: "Loading..."
access URL in browser: http://hostname:3000/, remote machine: failed, message: "Loading..."

Scenario 2:
ROOT_URL = http://192.168.123.45:3000/
access-URL in browser: http://localhost:3000/, local machine: failed, message: "Loading..."
access URL in browser: http://192.168.123.45:3000/, local machine: ok, preview is displayed
access URL in browser: http://192.168.123.45:3000/, remote machine: ok, preview is displayed
access URL in browser: http://hostname:3000/, local machine: failed, message: "Loading..."
access URL in browser: http://hostname:3000/, remote machine: failed, message: "Loading..."

Scenario 3:
ROOT_URL = http://hostname:3000/
access-URL in browser: http://localhost:3000/, local machine: failed, message: "Loading..."
access URL in browser: http://192.168.123.45:3000/, local machine: failed, message: "Loading..."
access URL in browser: http://192.168.123.45:3000/, remote machine: failed, message: "Loading..."
access URL in browser: http://hostname:3000/, local machine: ok, preview is displayed
access URL in browser: http://hostname:3000/, remote machine: ok, preview is displayed

notes:

  • there's a local DNS-server available/configured for hostname translation, hostname translation works also properly in other docker containers (e.g. pihole).
  • these scenarios have been tested as described above, however some scenarios have been validated in a slighly different environment (ubuntu 18.04 server with docker 19.03.6, build 369ce74a3c, google chrome as browser) - behaviour stays the same.

objective/goal: ROOT_URL should be ultimately the global hostname, but alternate access via IP/local hostname (or even localhost) should be also possible and fully functional (including preview). It seems also weird that everything else seems to be working even if the ROOT_URL doesn't match the access-URL.

Originally created by @fragment86 on GitHub (Jul 5, 2020). - Gitea version (or commit ref): docker image with tag "1.12.1" / docker image with tag: "latest" (currently 1.13.0+dev) - Git version: 2.24.3 / 2.26.2 - Operating system: ubuntu 20.04, docker: 19.03.8, build afacb8b7f0 - Browser: Firefox 78.0.1 - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - [ ] Not relevant - Log gist: ## Description preview for *.md-files failes ("Loading..." appears forever) when access url doesn't match ROOT_URL ('localhost' vs. IP vs. hostname). I tried the following settings: **Scenario 1:** ROOT_URL = http://localhost:3000/ access-URL in browser: http://localhost:3000/, local machine: **ok**, preview is displayed access URL in browser: http://192.168.123.45:3000/, local machine: **failed**, message: "Loading..." access URL in browser: http://192.168.123.45:3000/, remote machine: **failed**, message: "Loading..." access URL in browser: http://hostname:3000/, local machine: **failed**, message: "Loading..." access URL in browser: http://hostname:3000/, remote machine: **failed**, message: "Loading..." **Scenario 2:** ROOT_URL = http://192.168.123.45:3000/ access-URL in browser: http://localhost:3000/, local machine: **failed**, message: "Loading..." access URL in browser: http://192.168.123.45:3000/, local machine: **ok**, preview is displayed access URL in browser: http://192.168.123.45:3000/, remote machine: **ok**, preview is displayed access URL in browser: http://hostname:3000/, local machine: **failed**, message: "Loading..." access URL in browser: http://hostname:3000/, remote machine: **failed**, message: "Loading..." **Scenario 3:** ROOT_URL = http://hostname:3000/ access-URL in browser: http://localhost:3000/, local machine: **failed**, message: "Loading..." access URL in browser: http://192.168.123.45:3000/, local machine: **failed**, message: "Loading..." access URL in browser: http://192.168.123.45:3000/, remote machine: **failed**, message: "Loading..." access URL in browser: http://hostname:3000/, local machine: **ok**, preview is displayed access URL in browser: http://hostname:3000/, remote machine: **ok**, preview is displayed **notes:** - there's a local DNS-server available/configured for hostname translation, hostname translation works also properly in other docker containers (e.g. pihole). - these scenarios have been tested as described above, however some scenarios have been validated in a slighly different environment (ubuntu 18.04 server with docker 19.03.6, build 369ce74a3c, google chrome as browser) - behaviour stays the same. **objective/goal**: ROOT_URL should be ultimately the global hostname, but alternate access via IP/local hostname (or even localhost) should be also possible and fully functional (including preview). It seems also weird that everything else seems to be working even if the ROOT_URL doesn't match the access-URL.
GiteaMirror added the issue/stale label 2025-11-02 06:33:23 -06:00
Author
Owner

@stale[bot] commented on GitHub (Sep 5, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Sep 5, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Sep 20, 2020):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Sep 20, 2020): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5694