Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Gitea in sub-path config document is incompatible with path escaping #23711

Closed
wxiaoguang opened this issue Mar 26, 2023 · 1 comment · Fixed by #24616
Closed

[Doc] Gitea in sub-path config document is incompatible with path escaping #23711

wxiaoguang opened this issue Mar 26, 2023 · 1 comment · Fixed by #24616
Labels

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 26, 2023

Description

The ending slash shouldn't be used, because it causes nginx to unescape the path encodings, it breaks %2f in the path, breaks some Gitea git refs/paths and some Gitea package names/paths.

More details:

Thanks to @ghnp5

@ghnp5
Copy link

ghnp5 commented Mar 26, 2023

Note that the "Buggy" section has a slash so that it will work for the sub-path.

If you remove the slash, all pages on Gitea will get a 404, because the "git/" sub-path is being passed to all URLs to Gitea.

To fix that, this hack is needed:

	location /git/ {
		# this hack prevents URL encoding, which can break the Packages area, for package names with slashes
		rewrite ^ $request_uri;
		rewrite ^/git(/.*) $1 break;
		return 400; # if the second rewrite won't match
		proxy_pass http://127.0.0.1:1234$uri;

lunny pushed a commit that referenced this issue May 10, 2023
Close #23711, thanks to @ghnp5 !
Close  #24612, thanks to @DanielGibson !

Major changes:

* the default value of nginx's client_max_body_size is too small, so put
a 512M here
* move `Resolving Error: 413 Request Entity Too Large` to a sub-section
of `Nginx` section
* make nginx use unescaped the URI and keep "%2F" as is when using
sub-path
* add details for General sub-path configuration
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants