CollaboraOnline / richdocumentscode

Built-in CODE Server app
https://apps.nextcloud.com/apps/richdocumentscode
Apache License 2.0
117 stars 27 forks source link

502 Bad Gateway with built in CODE server - shows lool instead of cool #235

Open n-greene opened 1 year ago

n-greene commented 1 year ago

I am running NC 27.02 php8.1.2 pgsql15.4 with ssl termination in haproxy. OS Linux 5.15.0-79-generic x86_64 Ubuntu 22.04.3 LTS NC Office 8.1.1 CODE server 23.5.202

I am using the built in CODE server and currently it opens documents every third or fourth try.

I have wrestled with my Apache2 Virtualhost conf to get to this point. I was previously running Office/Built in CODE behind an NGINX reverse proxy with ssl termination and did not need any proxy directives in virtual host. I cannot be exact but it seemed like the trouble started before I switched over to Haproxy but I would not be able to pinpoint the versions of CODE and NC Office that changed with (last 3 months estimate) but I do keep everything updated at all times, for better or for worse.

Suffice it to say that what I have put in the current virtual host has been sufficient to get NC office to launch, at all, but not consistently or reliably. I would like to see the NC Office/Built in CODE working as it was.

In NC logs the following error shows up periodically, it references req=/lool/convert-to/png which I believe is an obsolete setting for CODE, being superceded by cool so I am not sure why this is still being referenced as I do have an up to date install.

[richdocuments] Info: GuzzleHttp\Exception\ServerException: Server error:POST https://xxx.xxxx.net/apps/richdocumentscode/proxy.php?req=/lool/convert-to/pngresulted in a502 Bad Gateway` response:

502 Bad Gateway

The server returned an invalid or incomplete response.

at <>

  1. /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 69 GuzzleHttp\Exception\RequestException::create(" sensitive parameters replaced ")
  2. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 204 GuzzleHttp\Middleware::GuzzleHttp{closure}(" sensitive parameters replaced ")
  3. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 153 GuzzleHttp\Promise\Promise::callHandler()
  4. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/TaskQueue.php line 48 GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}(" sensitive parameters replaced ")
  5. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 248 GuzzleHttp\Promise\TaskQueue->run()
  6. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 224 GuzzleHttp\Promise\Promise->invokeWaitFn()
  7. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 269 GuzzleHttp\Promise\Promise->waitIfPending()
  8. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 226 GuzzleHttp\Promise\Promise->invokeWaitList()
  9. /var/www/html/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php line 62 GuzzleHttp\Promise\Promise->waitIfPending()
  10. /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 187 GuzzleHttp\Promise\Promise->wait()
    1. /var/www/html/nextcloud/lib/private/Http/Client/Client.php line 297 GuzzleHttp\Client->request()
    2. /var/www/html/nextcloud/apps/richdocuments/lib/Preview/Office.php line 90 OC\Http\Client\Client->post()
    3. /var/www/html/nextcloud/lib/private/Preview/ProviderV1Adapter.php line 53 OCA\Richdocuments\Preview\Office->getThumbnail()
    4. /var/www/html/nextcloud/lib/private/Preview/GeneratorHelper.php line 64 OC\Preview\ProviderV1Adapter->getThumbnail()
    5. /var/www/html/nextcloud/lib/private/Preview/Generator.php line 397 OC\Preview\GeneratorHelper->getThumbnail()
    6. /var/www/html/nextcloud/lib/private/Preview/Generator.php line 373 OC\Preview\Generator->generateProviderPreview()
    7. /var/www/html/nextcloud/lib/private/Preview/Generator.php line 166 OC\Preview\Generator->getMaxPreview()
    8. /var/www/html/nextcloud/lib/private/Preview/Generator.php line 116 OC\Preview\Generator->generatePreviews()
    9. /var/www/html/nextcloud/lib/private/PreviewManager.php line 192 OC\Preview\Generator->getPreview()
    10. /var/www/html/nextcloud/core/Controller/PreviewController.php line 144 OC\PreviewManager->getPreview()
    11. /var/www/html/nextcloud/core/Controller/PreviewController.php line 113 OC\Core\Controller\PreviewController->fetchPreview()
    12. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230 OC\Core\Controller\PreviewController->getPreviewByFileId()
    13. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137 OC\AppFramework\Http\Dispatcher->executeController()
    14. /var/www/html/nextcloud/lib/private/AppFramework/App.php line 183 OC\AppFramework\Http\Dispatcher->dispatch()
    15. /var/www/html/nextcloud/lib/private/Route/Router.php line 315 OC\AppFramework\App::main()
    16. /var/www/html/nextcloud/lib/base.php line 1071 OC\Route\Router->match()
    17. /var/www/html/nextcloud/index.php line 36 OC::handleRequest()

GET /index.php/core/preview?forceIcon=0&a=0&c=07044c766b4e1f3ba7c2e17f201ee4f3&x=250&y=250&fileId=1270797 from 192.168.10.1 by xxxat 2023-08-16T13:00:39+00:00'

My Apache 2 virtual host is configured:

`<VirtualHost *:80> ServerName xxx.xxxx.net ServerAdmin xxxx@xxx.xxxxx.net DocumentRoot /var/www/html/nextcloud ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined

RequestHeader set X-FORWARDED-PROTOCOL https RequestHeader set X-Forwarded-Ssl on

AllowEncodedSlashes NoDecode ProxyAddHeaders On Proxypreservehost On LimitRequestBody 0 KeepAlive On

Redirect 301 /.well-known/carddav https:/xxx.xxxxx.nett/remote.php/dav Redirect 301 /.well-known/caldav https://xxx.xxxxx.net/remote.php/dav Redirect 301 /.well-known/webfinger https://xxx.xxxxx.net/index.php/.well-known/webfinger Redirect 301 /.well-known/nodeinfo https://xxx.xxxxx.net/index.php/.well-known/nodeinfo `

The Redirect 301 entries are for carddav and caldav to work behind haproxy, which they do.

Remedies attempted, based on searching for solutions:

I have tried setting WOPI to 0.0.0.0/0 I have tried remove/reinstall Built in CODE and NC Office, whilst running sudo killall coolswd in the interim I have tried selecting 'Use your own server' and then clicking back on the 'Use the built-in CODE' button which results in being able to open a document, but then lapses into failing to launch Nextcloud office. If I try opening the document three or four times it will open. I can see previews of the document type and when I do get a document open I can save.

The apache2 virtual host settings are probably going to upset someone, but I just went through ANYTHING I could find on this subject and tried it out - obviously explicit reverse proxy directives break apache because I am not running CODE on a separate server - I just left in stuff which did not throw an error on restarting apache2 - feel free to comment on unnecessary entries, I just could not find any documentation explicitly for built in CODE server.

timur-g commented 2 months ago

Built in CODE server is a simple testing ground for users, not meant to be used with complex reverse proxy for many. There are CODE packages and docker for that. While your report is admirable, it can hardly be resolved here as a support. lool is strange. Did you finally find a solution>