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

Docs: Reverse Proxy Documentation should mention client_max_body_size for nginx #24612

Closed
DanielGibson opened this issue May 9, 2023 · 6 comments · Fixed by #24616
Closed
Labels

Comments

@DanielGibson
Copy link

Description

I had problems with Gitea behind an nginx reverse proxy when trying to push big git LFS files.
I configured nginx like described in https://docs.gitea.io/en-us/administration/reverse-proxies/#nginx

The problem apparently was that nginx has a default size limit for uploading via http (at least in the default configuration on Ubuntu?), which can be overriden with client_max_body_size (e.g. `client_max_body_size 0; for "no limit").
Example:

server {
    listen 80;
    server_name git.example.com;
    # DG: disable size checking for uploads to prevent LFS problems
    client_max_body_size 0;

    location / {
        proxy_pass http://127.0.0.1:3000;
        ...

Gitea Version

any

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

behind a nginx reverse proxy

Database

None

@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 9, 2023

It's described in nginx doc, it does have default value : client_max_body_size 1m;

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

Context: http, server, location

It could be written in http or server or location , it depends on which scope you'd like to make it take affect.

update: and it is mentioned: https://docs.gitea.io/en-us/administration/reverse-proxies/#resolving-error-413-request-entity-too-large

@DanielGibson
Copy link
Author

I think server is the right place for this purpose.

1MB obviously is much too low to be useful for LFS, so indeed it would be helpful if the gitea documentation mentioned that one most probably wants to increase that value (or set to 0 for "no limit"), especially when using LFS (but even if you just want to let people upload screenshots in the issue tracker those might be >1MB)

@wxiaoguang
Copy link
Contributor

I guess it has been mentioned? https://docs.gitea.io/en-us/administration/reverse-proxies/#resolving-error-413-request-entity-too-large

That's on the same page.

@DanielGibson
Copy link
Author

oh sorry, must've missed that down there below all the other cases not relevant for me ;)

still: I think the posted config snippets should have this set (maybe with a short comment what it's for), so they work properly out of the box (instead of having to debug the problem later, maybe much later, at the first time someone tries to push a >1MB file)

@wxiaoguang
Copy link
Contributor

Good point 👍 some documents structure is not that good ....

And actually there are some bugs (eg: #23711 ), I think it's time to fine tune them.

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
@DanielGibson
Copy link
Author

thanks a lot for making the change! :)

@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