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

Closed
opened 2025-11-02 09:18:50 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @DanielGibson on GitHub (May 9, 2023).

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

Originally created by @DanielGibson on GitHub (May 9, 2023). ### 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
GiteaMirror added the type/bug label 2025-11-02 09:18:50 -06:00
Author
Owner

@wxiaoguang commented on GitHub (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

@wxiaoguang commented on GitHub (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
Author
Owner

@DanielGibson commented on GitHub (May 9, 2023):

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)

@DanielGibson commented on GitHub (May 9, 2023): 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)
Author
Owner

@wxiaoguang commented on GitHub (May 9, 2023):

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.

@wxiaoguang commented on GitHub (May 9, 2023): 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.
Author
Owner

@DanielGibson commented on GitHub (May 9, 2023):

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)

@DanielGibson commented on GitHub (May 9, 2023): 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)
Author
Owner

@wxiaoguang commented on GitHub (May 9, 2023):

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.

@wxiaoguang commented on GitHub (May 9, 2023): 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.
Author
Owner

@DanielGibson commented on GitHub (May 10, 2023):

thanks a lot for making the change! :)

@DanielGibson commented on GitHub (May 10, 2023): thanks a lot for making the change! :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10813