Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built in CODE server incompatible wiht uwsgi in nextcloud? #228

Open
naclander opened this issue Jun 15, 2023 · 2 comments
Open

Built in CODE server incompatible wiht uwsgi in nextcloud? #228

naclander opened this issue Jun 15, 2023 · 2 comments

Comments

@naclander
Copy link

naclander commented Jun 15, 2023

I am running nextcloud using uwsgi as recommended in the Arch Linux article. This means I have a slightly modified nginx configuration file like so:

...
# stuff
...
    location ~ \.php(?:$|/) {
        # Required for legacy support
        rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;

        include uwsgi_params;
        uwsgi_modifier1 14;
        # Avoid duplicate headers confusing OC checks
        uwsgi_hide_header X-Frame-Options;
        uwsgi_hide_header X-XSS-Protection;
        uwsgi_hide_header X-Content-Type-Options;
        uwsgi_hide_header X-Robots-Tag;
        uwsgi_hide_header X-Download-Options;
        uwsgi_hide_header X-Permitted-Cross-Domain-Policies;
        uwsgi_pass unix:/run/nextcloud/nextcloud.sock;
...
# more stuff
...

Presumably the Collabora built in CODE server works when provided the recommended nginx config from nextcloud but it does not seem to work for me when modifying the nginx config as above.

Looking at nextcloud/nextcloud.log, I see the following error ( formatted for readability )

{
  "reqId": "RXD329HE6QsILOrawoa3",
  "level": 3,
  "time": "2023-06-15T06:06:50+00:00",
  "remoteAddr": "10.9.1.1",
  "user": "nac",
  "app": "richdocuments",
  "method": "POST",
  "url": "/index.php/apps/richdocuments/ajax/admin.php",
  "message": "Failed to fetch the Collabora capabilities endpoint: Client error: `GET https://nextcloud.domain.com/wapps/richdocumentscode/proxy.php?req=/hosting/capabilities` resulted in a `403 Forbidden` response:\nForbidden\n",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0",
  "version": "26.0.2.1",
  "exception": {
    "Exception": "GuzzleHttp\\Exception\\ClientException",
    "Message": "Client error: `GET https://nextcloud.domain.com/wapps/richdocumentscode/proxy.php?req=/hosting/capabilities` resulted in a `403 Forbidden` response:\nForbidden\n",
    "Code": 403,
    "Trace": [
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
        "line": 69,
        "function": "create",
        "class": "GuzzleHttp\\Exception\\RequestException",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 204,
        "function": "GuzzleHttp\\{closure}",
        "class": "GuzzleHttp\\Middleware",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 153,
        "function": "callHandler",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "::"
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/TaskQueue.php",
        "line": 48,
        "function": "GuzzleHttp\\Promise\\{closure}",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 248,
        "function": "run",
        "class": "GuzzleHttp\\Promise\\TaskQueue",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 224,
        "function": "invokeWaitFn",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 269,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 226,
        "function": "invokeWaitList",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 62,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php",
        "line": 187,
        "function": "wait",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/private/Http/Client/Client.php",
        "line": 226,
        "function": "request",
        "class": "GuzzleHttp\\Client",
        "type": "->"
      },
      {
        "file": "/var/lib/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php",
        "line": 135,
        "function": "get",
        "class": "OC\\Http\\Client\\Client",
        "type": "->"
      },
      {
        "file": "/var/lib/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php",
        "line": 73,
        "function": "refetch",
        "class": "OCA\\Richdocuments\\Service\\CapabilitiesService",
        "type": "->"
      },
      {
        "file": "/var/lib/nextcloud/apps/richdocuments/lib/AppInfo/Application.php",
        "line": 80,
        "function": "getCapabilities",
        "class": "OCA\\Richdocuments\\Service\\CapabilitiesService",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php",
        "line": 66,
        "function": "OCA\\Richdocuments\\AppInfo\\{closure}",
        "class": "OCA\\Richdocuments\\AppInfo\\Application",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/Bootstrap/BootContext.php",
        "line": 50,
        "function": "injectFn",
        "class": "OC\\AppFramework\\Bootstrap\\FunctionInjector",
        "type": "->"
      },
      {
        "file": "/var/lib/nextcloud/apps/richdocuments/lib/AppInfo/Application.php",
        "line": 135,
        "function": "injectFn",
        "class": "OC\\AppFramework\\Bootstrap\\BootContext",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php",
        "line": 200,
        "function": "boot",
        "class": "OCA\\Richdocuments\\AppInfo\\Application",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/private/legacy/OC_App.php",
        "line": 213,
        "function": "bootApp",
        "class": "OC\\AppFramework\\Bootstrap\\Coordinator",
        "type": "->"
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/private/legacy/OC_App.php",
        "line": 141,
        "function": "loadApp",
        "class": "OC_App",
        "type": "::"
      },
      {
        "file": "/usr/share/webapps/nextcloud/lib/base.php",
        "line": 1038,
        "function": "loadApps",
        "class": "OC_App",
        "type": "::"
      },
      {
        "file": "/usr/share/webapps/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php",
    "Line": 113,
    "message": "Failed to fetch the Collabora capabilities endpoint: Client error: `GET https://nextcloud.domain.com/wapps/richdocumentscode/proxy.php?req=/hosting/capabilities` resulted in a `403 Forbidden` response:\nForbidden\n",
    "exception": {},
    "CustomMessage": "Failed to fetch the Collabora capabilities endpoint: Client error: `GET https://nextcloud.domain.com/wapps/richdocumentscode/proxy.php?req=/hosting/capabilities` resulted in a `403 Forbidden` response:\nForbidden\n"
  }
}

I assume nginx is not parsing and modofying the url nextcloud is trying to reach collabora built in code server on: https://nextcloud.domain.com/wapps/richdocumentscode/proxy.php?req=/hosting/capabilities.

Is there any advice on how I can make this work? Is nextcloud/collabora doing the right thing here? Because the rest of the functionality ( and other apps ) in nextcloud seem to work fine.

@joshtrichards
Copy link
Contributor

joshtrichards commented Jul 13, 2023

Hi @naclander -

Arch Linux doesn't have that rewrite line in their example config (though I'm unclear why). Maybe they had a good reason. Either way, it's not something supported officially by Nextcloud and this is a forum for reporting bugs not general troubleshooting assistance.

As this is a configuration issue, I'd suggest posting this at the Nextcloud Help Forum or maybe - better yet - the Arch Linux one because that is an configuration that seems to be coming up because of what they're suggesting on their Wiki.

General troubleshooting hints:

  • You should be able to access https://nextcloud.domain.com/wapps/richdocumentscode/proxy.php?req=/hosting/capabilities from your web browser.
  • The entire nginx config matters so if you've customized anything else versus the NGINX one in the NC Admin Manual you could be hitting some other rule
  • Check your nginx logs for determining the cause of the 403 error (well and to confirm with certainty it's getting that far)
  • I assume that wapps (with the w) is some sort of custom app path you've configured in NC?

@naclander
Copy link
Author

Are you saying uwsgi is not supported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants