# Nginx produces 412 errors

**URL:** <https://help.nextcloud.com/t/nginx-produces-412-errors/84434>\
**Category:** ℹ️ Support\
**Tags:** nginx\
**Created:** [June 11, 2020, 7:58pm UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434 "2020-06-11T19:58:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoursql719](https://help.nextcloud.com/user_avatar/help.nextcloud.com/yoursql719/32/650_2.png) [@yoursql719](https://help.nextcloud.com/u/yoursql719)\
**Post date:** [June 11, 2020, 7:58pm UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434/1 "2020-06-11T19:58:31Z")

</div>

Hi,

since my migration to a new server I´m getting 412 errors at my web browser console from time to time at loading the file list or when I am writing a note:

```
files.js?v=8a34a280-10:51 POST https://cloud.xy.de/apps/text/session/sync 412
(anonymous) @ files.js?v=8a34a280-10:51
e.exports @ files.js?v=8a34a280-10:51
e.exports @ files.js?v=8a34a280-10:51
Promise.then (async)
c.request @ files.js?v=8a34a280-10:51
r.forEach.c.<computed> @ files.js?v=8a34a280-10:51
(anonymous) @ files.js?v=8a34a280-10:51
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.catch (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
Promise.then (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
setInterval (async)
value @ editor.js?v=5145bf0dbc6192145c28:23
(anonymous) @ editor.js?v=5145bf0dbc6192145c28:23
editor.js?v=5145bf0dbc6192145c28:23 Failed to fetch steps due to other reason Error: Request failed with status code 412
    at e.exports (files.js?v=8a34a280-10:51)
    at e.exports (files.js?v=8a34a280-10:51)
    at XMLHttpRequest.d.onreadystatechange (files.js?v=8a34a280-10:51)

```

I don´t know what I could have missed. My nginx config is:

```
server {
    listen 443 ssl http2 default_server;
    server_name cloud.xy.de;
    ssl_certificate /etc/letsencrypt/live/cloud.xy.de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cloud.xy.de/privkey.pem;
    add_header Strict-Transport-Security "max-age=63072000; preload";
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
    add_header Referrer-Policy "strict-origin";
    root /var/kunden/cloud/httpdocs/nextcloud;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
    }

    location = /.well-known/carddav { return 301
            $scheme://$host/remote.php/dav; }
    location = /.well-known/caldav { return 301
            $scheme://$host/remote.php/dav; }

    location /.well-known/acme-challenge { }

    # set max upload size
    client_max_body_size 16400M;
    client_body_buffer_size 2048576k;
    client_body_temp_path /var/ngx_body;
    fastcgi_buffers 64 4K;
    gzip off;

    rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
    rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
    rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;

    #pagespeed off;

    location / {
            rewrite ^ /index.php$request_uri;
            rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
            rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

            rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
            rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;

            rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
    }

    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
            deny all;
    }

    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
            deny all;
    }

    location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            include fastcgi_params;
            try_files $fastcgi_script_name =404;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param HTTPS on;
            fastcgi_param modHeadersAvailable true;
            fastcgi_param front_controller_active true;
            fastcgi_pass unix:/var/run/php/php7.3-fpm-cloud.sock;
            fastcgi_intercept_errors on;
            #fastcgi_request_buffering off;
            fastcgi_read_timeout 76000;
            fastcgi_connect_timeout 60;
            fastcgi_send_timeout 180;
            #fastcgi_cache OWNCLOUD;
            #fastcgi_cache_valid 60m;
    }

    location ~ ^/(?:updater|ocs-provider)(?:$|/) {
            try_files $uri/ =404;
            index index.php;
    }

    location ~* \.(?:css|js)$ {
            try_files $uri /index.php$uri$is_args$args;
            add_header Cache-Control "public, max-age=7200";
            add_header X-Content-Type-Options nosniff;
            add_header X-Frame-Options "SAMEORIGIN";
            add_header X-XSS-Protection "1; mode=block";
            add_header X-Robots-Tag none;
            add_header X-Download-Options noopen;
            add_header X-Permitted-Cross-Domain-Policies none;
            access_log off;
    }

    location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
            try_files $uri /index.php$uri$is_args$args;
            access_log off;
}

```

}

Has anyone an useful hint for me?

---

<div class="post-metadata">

**Author:** ![pReya](https://help.nextcloud.com/user_avatar/help.nextcloud.com/preya/32/27211_2.png) [@pReya](https://help.nextcloud.com/u/pReya)\
**Post date:** [February 7, 2021, 10:32am UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434/2 "2021-02-07T10:32:37Z")

</div>

I do get the same 412 errors from my instance. It’s making me crazy. Happens while editing markdown files in the “Notes” app.

---

<div class="post-metadata">

**Author:** ![hmt](https://help.nextcloud.com/user_avatar/help.nextcloud.com/hmt/32/10357_2.png) [@hmt](https://help.nextcloud.com/u/hmt)\
**Post date:** [April 20, 2021, 6:17am UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434/3 "2021-04-20T06:17:42Z")

</div>

No solution to this? I have to paste text into my Markdown files because editing them is impossible.

---

<div class="post-metadata">

**Author:** ![pReya](https://help.nextcloud.com/user_avatar/help.nextcloud.com/preya/32/27211_2.png) [@pReya](https://help.nextcloud.com/u/pReya)\
**Post date:** [August 12, 2021, 9:18pm UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434/4 "2021-08-12T21:18:17Z")

</div>

Problem is still persisting for me. Currently on Nextcloud 21 running on Apache. It makes using the Markdown editor really difficult, because it randomly fails after a while.

I looked at the difference between the requests, when they’re working, and when they fail (due to HTTP 412). Seems the only difference between them is in the cookie. While the requests succeed, there is an entry in the cookie like this: `ocfi1sfm2880=dht2tl7djsh9812aqbsubn6unb` This is completely missing, in the requests which fail due to 412.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 12, 2024, 7:19am UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434/5 "2024-12-12T07:19:49Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 12, 2024, 7:19am UTC](https://help.nextcloud.com/t/nginx-produces-412-errors/84434/6 "2024-12-12T07:19:50Z")

</div>


