I use Nginx with php-fpm on my server to run my Wordpress blog.

When someone share my website on Facebook, some parameters are added by Facebook and the URL looks like :


I checked my logs and I have a "414 Request-URI Too Long" with this request. I try to add large_client_header_buffers in my Nginx config file but without result.

However, if you only use the normal URL (https://jp.rlauzier.com/2013/07/les-courriels-et-la-securite-quelques-notions-a-savoir/), everything work correctly.

Here's my configuration file:

server {
    listen          443;
    server_name     jp.rlauzier.com;

    ssl on;
    ssl_certificate         /etc/nginx/ssl/jp.rlauzier.com.crt;
    ssl_certificate_key     /etc/nginx/ssl/jp.rlauzier.com.key;

    include /var/www/jp.rlauzier.com/public_html/nginx.conf;

    location / {
            root   /var/www/jp.rlauzier.com/public_html/;
            index  index.php index.html index.htm;

            if ($request_uri ~* \.(ico|css|js|gif|jpe?g|png)$) {
                    expires max;

            try_files $uri $uri/ /index.php?q=$uri&$args;

    # pass the PHP scripts to FastCGI server listening on
    location ~ \.php$ {
            root           /var/www/jp.rlauzier.com/public_html/;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;

    location ~ /(\.|wp-config.php|nginx.conf|readme.html|license.txt) {
            return 404;

server {
    listen       80;
    server_name  jp.rlauzier.com rlauzier.com;

    rewrite     ^ https://jp.rlauzier.com$request_uri? permanent;

From somewhere on the internet:

Most likely you are trying to configure client_header_buffer_size/large_client_header_buffers in a pure virtual server{}. This won't work as request headers parsing happens before Host header is known (and virtual server isselected), hence parseing happens in a context of the default server for a listen socket.

You have to configure client_header_buffer_size/large_client_header_buffers in a default server (or at http level).

  • Also from that page: check if it isn't your fastcgi daemon actually returning the 414. – Dennis Kaarsemaker Jul 6 '13 at 18:42
  • Nope, you can see from the headers that it came from nginx. – Michael Hampton Jul 6 '13 at 19:03
  • I viewed a few times this discussion... I tried to add client_header_buffer_size/large_client_header_buffers in the config file /etc/nginx/nginx.conf between http {...} ... Is that "http level" mean? Thanks. – Jean-Philippe Rivard Lauzier Jul 6 '13 at 19:05

Found the guilty one... Better WP Security Plugin !

There is an option to limit the URLs length.

However, this plugin is amazing but adds many tweaks to protect a Wordpress installation by default.

Thanks all for your help!

  • I was digging around for nginx config for WAY too long... WP devs beware. – emc Feb 26 '16 at 22:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.