owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.36k stars 180 forks source link

[BUG] TUS 404 after configuring onlyoffice #8367

Closed TheRouce closed 7 months ago

TheRouce commented 7 months ago

Describe the bug

TUS 404 after configuring onlyoffice

Steps to reproduce

  1. Upload xlsx, webp, png, etc.
  2. See error in Firefox/Chrome console.

Expected behavior

Upload through TUS passing properly

Actual behavior

After setting up onlyoffice web editor I get a new error:

[Uppy] [15:15:03] tus: unexpected response while creating upload, originated from request (method: POST, url: https://cloud.domain.tld/remote.php/dav/spaces/cb3503a7-23db-4bad-ab96-b940a0909064$11d2cd3e-d56d-4d85-9a8d-7614fca8e067, response code: 404, response text: , request id: 3bf62166-a7c9-4cf9-a3fd-46f3cdcf3efe) vendor-trS8ibVH.mjs:25:8930
    error https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    log https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    DPe https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    i https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    emit https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    emit https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    onError https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    value https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    value https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25
    value https://cloud.domain.tld/js/chunks/vendor-trS8ibVH.mjs:25

Setup

OCIS .env file and nginx config file

```console OCIS_INSECURE=false PROXY_HTTP_ADDR=0.0.0.0:9200 OCIS_LOG_PRETTY=true OCIS_LOG_COLOR=true OCIS_LOG_LEVEL=warn NATS_NATS_HOST=0.0.0.0 NATS_NATS_PORT=9233 OCIS_URL=https://cloud.domain.tld OCIS_CONFIG_DIR=/etc/ocis OCIS_BASE_DATA_PATH=/var/lib/ocis SEARCH_EXTRACTOR_TYPE=tika SEARCH_EXTRACTOR_TIKA_TIKA_URL=http://tika:9998 FRONTEND_FULL_TEXT_SEARCH_ENABLED=true MICRO_REGISTRY_ADDRESS=0.0.0.0:9233 GATEWAY_GRPC_ADDR=0.0.0.0:9142 WOPISERVER_DOCKER_TAG=v10.3.0 WOPI_JWT_SECRET="secret" WOPISERVER_INSECURE=false WOPISECRET="secret" ONLYOFFICE_DOMAIN=onlyoffice.cloud.domain.tld APP_PROVIDER_WOPI_APP_ICON_URI=https://onlyoffice.cloud.domain.tld/web-apps/apps/documenteditor/main/resources/img/favicon.ico APP_PROVIDER_WOPI_APP_URL=https://onlyoffice.cloud.domain.tld APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL=https://cloud.domain.tld APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL=https://wopi.cloud.domain.tld ```

```console server { client_max_body_size 2000M; server_name cloud.domain.tld; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass https://localhost:9200; proxy_buffers 16 4k; proxy_buffer_size 2k; } error_page 500 502 503 504 /error_code.html; location /error_code.html { root /etc/nginx/error_pages; internal; } location /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; } listen [::]:443 ssl http2; listen 443 ssl http2; ssl_certificate /etc/letsencrypt/live/cloud.domain.tld/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/cloud.domain.tld/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; } server { if ($host = cloud.domain.tld) { return 301 https://$host$request_uri; } server_name cloud.domain.tld; listen [::]:80; listen 80; return 404; } ```

OCIS docker log:

2024-02-05T20:24:34Z WRN core access token not set pkg=rhttp service=frontend traceid=155da5facfaeb048804b25b091bd2b73
2024-02-05T20:24:36Z WRN core access token not set pkg=rhttp service=frontend traceid=b86d54b86a3d16afc9b8471d34bb54c9

Additional context

I am almost 100% sure this is user error, I am running an OCIS instance just to test how it works and maybe move it to a production server in the future. I would love feedback on anything I did wrong or anything I'm missing.

EDIT When I get a chance to restart the server I'll enable debug log level

TheRouce commented 7 months ago

It's working now, turns out it was an nginx issue, which I probably should have expected, here's the working ocis config I ended up with:

server {

        ssl_stapling on;
        ssl_stapling_verify on;

        server_name cloud.domain.tld;

        listen [::]:443 ssl ipv6only=on; # managed by Certbot
        listen 443 ssl; # managed by Certbot

        ssl_certificate /etc/letsencrypt/live/cloud.domain.tld/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/cloud.domain.tld/privkey.pem; # managed by Certbot

        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

        location / {
                #proxy_buffers 4 256k;
                #proxy_buffer_size 128k;
                #proxy_busy_buffers_size 256k;

                proxy_request_buffering off;
                proxy_buffering off;
                proxy_http_version 1.1;

                client_max_body_size 0;

                proxy_pass https://localhost:9200;
                #proxy_set_header Host $host;

                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;

                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";

        }

}

server {
    if ($host = cloud.domain.tld) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

    server_name cloud.domain.tld;
    return 404; # managed by Certbot
}

I mostly just combined the config file from the bare metal docs on doc.owncloud.com with the config file from the tusd github