Guide regarding reverse proxy setup for Caddy #2348

Closed
opened 2025-11-02 04:33:31 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @victpork on GitHub (Sep 19, 2018).

  • Gitea version (or commit ref): f6eb669
  • Git version:
  • Operating system: Ubuntu Linux
  • 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

On page https://docs.gitea.io/en-us/reverse-proxies/ the guide for Caddy setting subpath reverse proxy does not work on me, which is

git.example.com {
    proxy /git/ http://localhost:3000 # Note: Trailing Slash after /git/
}

took me some time to figure out it should be

git.example.com {
    proxy /git/ http://localhost:3000  {  # Note: Trailing Slash after /git/ 
          without /git
    }
}

I'm using Caddy 0.11.0 . Let me know if this only happens on me or the doc needs update.

Originally created by @victpork on GitHub (Sep 19, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) 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): f6eb669 - Git version: - Operating system: Ubuntu Linux - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description On page https://docs.gitea.io/en-us/reverse-proxies/ the guide for Caddy setting subpath reverse proxy does not work on me, which is ``` git.example.com { proxy /git/ http://localhost:3000 # Note: Trailing Slash after /git/ } ``` took me some time to figure out it should be ``` git.example.com { proxy /git/ http://localhost:3000 { # Note: Trailing Slash after /git/ without /git } } ``` I'm using Caddy 0.11.0 . Let me know if this only happens on me or the doc needs update. <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the issue/staletype/docs labels 2025-11-02 04:33:31 -06:00
Author
Owner

@tankerkiller125 commented on GitHub (Sep 21, 2018):

Mine is working perfectly with caddy as a reverse proxy, I do have some custom settings though so I will have to get that config off my server sometime when I get a chance.

@tankerkiller125 commented on GitHub (Sep 21, 2018): Mine is working perfectly with caddy as a reverse proxy, I do have some custom settings though so I will have to get that config off my server sometime when I get a chance.
Author
Owner

@Anaphylaxis commented on GitHub (Sep 23, 2018):

Additionally I can't seem to get dynamic things working (including the "Remember Me" box on the login page) using a Caddy reverse proxy. Tried all kinds of different setups.

@Anaphylaxis commented on GitHub (Sep 23, 2018): Additionally I can't seem to get dynamic things working (including the "Remember Me" box on the login page) using a Caddy reverse proxy. Tried all kinds of different setups.
Author
Owner

@sapk commented on GitHub (Sep 23, 2018):

@mkishere What is the value of ROOT_URL in your config file ? Make sure to have it config like specified at the end of doc when using sub-path proxy (https://docs.gitea.io/en-us/reverse-proxies/#using-caddy-with-a-sub-path-as-a-reverse-proxy-1)

@sapk commented on GitHub (Sep 23, 2018): @mkishere What is the value of `ROOT_URL` in your config file ? Make sure to have it config like specified at the end of doc when using sub-path proxy (https://docs.gitea.io/en-us/reverse-proxies/#using-caddy-with-a-sub-path-as-a-reverse-proxy-1)
Author
Owner

@victpork commented on GitHub (Sep 24, 2018):

I remember I did set the ROOT_URL with /git/ at the end as the document told, and still gitea return 404 for requests that prefix with the /git/ path.

But since I have switched settings (switching from subpath to subdomain), I'll need some time to reproduce and stick the logs to here.

EDIT: Just tried again setting ROOT_URL to http://domain/git/ , path prefix with /git/ requests to gitea still returns 404. The index page generates links with /git/ prefix though.

Excerpt from curl localhost:3000 :

<script src="/git/vendor/plugins/jquery/jquery.min.js"></script>
        <script src="/git/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script>

Log (from docker-compose logs gitea):

gitea_1         | [Macaron] 2018-09-24 07:25:57: Started GET /git/vendor/plugins/jquery/jquery.min.js for 118.142.94.222
...
gitea_1         | [Macaron] 2018-09-24 07:25:57: Completed GET /git/vendor/plugins/jquery/jquery.min.js 404 Not Found in 4.298407ms
@victpork commented on GitHub (Sep 24, 2018): I remember I did set the ROOT_URL with /git/ at the end as the document told, and still gitea return 404 for requests that prefix with the /git/ path. But since I have switched settings (switching from subpath to subdomain), I'll need some time to reproduce and stick the logs to here. **EDIT**: Just tried again setting ROOT_URL to http://domain/git/ , path prefix with /git/ requests to gitea still returns 404. The index page generates links with /git/ prefix though. Excerpt from curl localhost:3000 : ```html <script src="/git/vendor/plugins/jquery/jquery.min.js"></script> <script src="/git/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script> ``` Log (from docker-compose logs gitea): ```text gitea_1 | [Macaron] 2018-09-24 07:25:57: Started GET /git/vendor/plugins/jquery/jquery.min.js for 118.142.94.222 ... gitea_1 | [Macaron] 2018-09-24 07:25:57: Completed GET /git/vendor/plugins/jquery/jquery.min.js 404 Not Found in 4.298407ms ``` ```
Author
Owner

@stale[bot] commented on GitHub (Jan 8, 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 8, 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

@stale[bot] commented on GitHub (Feb 22, 2019):

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

@stale[bot] commented on GitHub (Feb 22, 2019): 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#2348