Issue with NGINX +Nextcloud + shifts and 405 error

Not sure if the is the beall - endall solution.

in shifts (app in the store) …
the settings are saved using a /settings/… url.
Problem put goes through location / { try_files … }.
A put to /… is NOT allowed, as there is no proxy_pass inside the location block,

The following seems to work:

    error_page 405 =200 @post_static ;        # handle 405 errors using te @post_static block.
    location @post_static {
         proxy_pass https://$server_name/index.php/$request_uri ;    # do proxy_pass
         proxy_redirect off;
    location / {                      # handle . requests.
        try_files $uri /index.php$request_uri;

Without this post requests fail with 405 error. blocking
THe above also might solve an issue with a 404 error resulting from a redirect from
/settings → /settings/ wich nextcloud cannot handle.

1 Like

It’s a bit confusing, you refer to the shifts app, but your problem is related to this app? It doesn’t seem to require a specific setup of the webserver?

Did you start from the default nginx file from the documentation? NGINX configuration — Nextcloud latest Administration Manual latest documentation

You’ll need to more more details about your general setup/topology.

It’s unusual to have a proxy (proxy_pass) that has special handling like that.

It doesn’t like sound you’re using any of the conventional Nextcloud Server NGINX configurations I’m aware of.

It almost sounds like you’re mixing up the NGINX+FPM config with a pure NGINX Reverse Proxy → Web Server config.

Where is Nextcloud itself installed? Where is FPM? etc.

The problem is when there is no script (backend, proxypass…) a post is NOT allowed.
In shift it looks like MANY things are handled on a POST with an URL pointing to static data

And Yes this is SHIFTS related. (the only app with this (type of) error).
I have yet to find a failing application besides shifts.

While the above makes SHIFTPLAN app function, it introduced quirk for other applications.
Why would SHIFTS use a POST with a static URL?..
In the current state SHIFTPLAN is a failed application.

Nextcloud, NGINX, FPM are all installed on one system.
The NGINX, Nextcloud config is taken from the NC documentation site, and several items are added as required by various applications (like Office, NextPush).
This NGINX config is also kept current from nc 11 up to NC 28.

And yes adding the reverse proxy elements make SHIFTPLAN more or less function as intended. (At least not error out with 405 errors).
The best way would be is in stead of using /settings/… SHIFTPLAN would use /index.php/settings…

I have no idea what you are doing. These errors happen when you use the app through the web-interface?

The following makes a few errors disappear in shiftplan:

appearantly shiftplan uses a post: /apps/shiftplan/set/… whatever…
NGINX does not allow a post to a non-proxy/redirect entry. (php processing is done in php-fpm).
As there is no .php in the URL, nginx .php location block does not match.
Fix is using an alternate location ~ / block.

    location ~ / {
        if ($request_method ~ ^(PUT|DELETE|PATCH|PROPFIND|PROPPATCH)$) {
            rewrite ^ /index.php$request_uri last;
        try_files $uri $uri/ /index.php$request_uri;

At least a partial solution, somehow groups as show in still don’t allow someone to become a shift leader … only swapping of shifts is allowed…
Lack of admin rights probably.

Steps set, no solution yet.