PrivateBin / PrivateBin

A minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES.
https://privatebin.info/
Other
6.57k stars 815 forks source link

Could not create paste: Invalid data. #1452

Closed pf0 closed 1 week ago

pf0 commented 2 weeks ago

Did you use the FAQ section?

Privatebin displays 'Could not create paste: Invalid data' when submitting a paste. Sadly, I did not find any other information from browser, nginx or php-fpm logs.

Steps to reproduce

I am running privatebin behind nginx with the following nginx.conf: ` server { listen 443 ssl; server_name bin.rock.home.arpa; include /usr/local/etc/nginx/mime.types;

            ssl_certificate      /etc/ssl/127.0.0.1.crt;
            ssl_certificate_key  /etc/ssl/private/127.0.0.1.key;

            ssl_session_cache    shared:SSL:1m;
            ssl_session_timeout  5m;

            ssl_ciphers  HIGH:!aNULL:!MD5;
            ssl_prefer_server_ciphers  on;

            root /usr/local/www/privatebin;

            index index.php;
            location / {
                    try_files $uri $uri/ =404;
            }
            location  ~ \.php$ {
                    fastcgi_param REQUEST_METHOD $request_method;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    # https://easyengine.io/tutorials/nginx/forwarding-visitors-real-ip/
                    fastcgi_param REMOTE_ADDR $http_x_real_ip;
                    fastcgi_pass unix:/var/run/php-fpm.sock;
            }

`

What happens

Paste is not created and a error message is displayed instead.

What should happen

The example paste should be created and a corresponding link should be provided.

Additional information

image

Basic information

Server address:

Server OS: FreeBSD

Webserver: nginx

Browser: Mozilla Firefox 131.0.3

PrivateBin version: 1.7.4

I can reproduce this issue on https://privatebin.net: No

elrido commented 1 week ago

Invalid data is the error sent by the server when it can't validate the JSON payload, for example the message could have gotten truncated along the way and the server only receives an incomplete JSON. Check your webserver and php-fpm configuration for any kind of size limit that might cut off the message. Also try of smaller messages work. Check for any webserver plugins or CDNs that might mess with the payload in any way.

pf0 commented 1 week ago

Thank you for the fast response! After adding include /usr/local/etc/nginx/fastcgi_params; inside the php location everything works fine. I assume it had something to do with the missing CONTENT_LENGTH fastcgi_param.