nginx reverse proxy with subpath documentation not valid nginx syntax #7362

Closed
opened 2025-11-02 07:23:57 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @gabevenberg on GitHub (May 20, 2021).

This is what works for me for http://domain.com/git/ (running nginx/1.16.1 and Gitea version 1.8.3+2-g11f6ed4f8 built with go1.12.6 : bindata, sqlite, sqlite_unlock_notify):

server {
    listen 80;
    server_name domain.com ;

location /git/ {
    proxy_pass http://localhost:3000/;
    }
}

Without the trailing slash on proxy_pass everything was 404.

Originally posted by @defulmere in https://github.com/go-gitea/gitea/issues/8635#issuecomment-625485258

when using the above in an nginx config, nginx gives me the following error:
nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/locations/venberg.xyz_sites/gitea:2
using @donpdonp 's inital solution worked perfectly.

only issue now is that mydomain.xyz/git/ works, but mydomain.xyz/git (without trailing space) gives a 404 error.

Originally created by @gabevenberg on GitHub (May 20, 2021). This is what works for me for `http://domain.com/git/` (running nginx/1.16.1 and Gitea version 1.8.3+2-g11f6ed4f8 built with go1.12.6 : bindata, sqlite, sqlite_unlock_notify): ``` server { listen 80; server_name domain.com ; location /git/ { proxy_pass http://localhost:3000/; } } ``` Without the trailing slash on proxy_pass everything was 404. _Originally posted by @defulmere in https://github.com/go-gitea/gitea/issues/8635#issuecomment-625485258_ when using the above in an nginx config, nginx gives me the following error: nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/locations/venberg.xyz_sites/gitea:2 using @donpdonp 's inital solution worked perfectly. only issue now is that mydomain.xyz/git/ works, but mydomain.xyz/git (without trailing space) gives a 404 error.
GiteaMirror added the type/docs label 2025-11-02 07:23:57 -06:00
Author
Owner

@stale[bot] commented on GitHub (Jul 21, 2021):

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 (Jul 21, 2021): 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

@pat-s commented on GitHub (Jul 21, 2021):

The docs as of today already have this trailing slash added.
Did not check when it was added.

@pat-s commented on GitHub (Jul 21, 2021): The [docs as of today](https://docs.gitea.io/en-us/reverse-proxies/#nginx-with-a-sub-path) already have this trailing slash added. Did not check when it was added.
Author
Owner

@zeripath commented on GitHub (Jul 21, 2021):

sounds like this fixed then.

@zeripath commented on GitHub (Jul 21, 2021): sounds like this fixed then.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7362