Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker push nexus private repo fail, 413 Request Entity Too Large

I've deployed an on prem instance of Nexus OSS, that is reached behind a Nginx reverse proxy.

On any attempt to push docker images to a repo created on the Nexus registry I'm bumping into a 413 Request Entity Too Large in the middle of the push.

The nginx.conf file is looking like so:

http {
    client_max_body_size 0;
    upstream nexus_docker {
        server nexus:1800;
    } 
    server {
        server_name nexus.services.loc;
        location / {
            proxy_pass http://nexus_docker/;
            proxy_set_header Host $http_post;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        } 
    } 
} 

The nginx is deployed using docker, and I've successfully logged in to it using docker login. I've tried multiple other flags, such as the chunkin and such. But nothing seems to work.

like image 738
Boaz Berman Avatar asked Jan 07 '19 13:01

Boaz Berman


People also ask

What is a 413 Request Entity Too Large error& how to Fix it?

What does “413 Request Entity Too Large” mean? A 413 HTTP error code occurs when the size of a client's request exceeds the server's file size limit. This typically happens when a client attempts to upload a large file to a web server, and the server responds with a 413 error to alert the client.


2 Answers

That's due to your server block having a default value for client_max_body_size of around 1MB in size when unset.

To resolve this, you will need to add the following line to your server block:

# Unlimit large file uploads to avoid "413 Request Entity Too Large" error
client_max_body_size 0;

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

like image 151
sktan Avatar answered Oct 24 '22 08:10

sktan


As it turns out, the linux distro running the containered nginx server was itself running a variation of nginx for any incoming request.

Once we set the client_max_body_size to 0 on the nginx configuration file which the OS ran, it worked.

like image 5
Boaz Berman Avatar answered Oct 24 '22 08:10

Boaz Berman