Nextcloud AIO "/cool/convert-to/png` resulted in a `502 Bad Gateway" errors

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Nextcloud AIO using 32.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • host is Ubuntu 24.04
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Caddy - separate server
  • PHP version (e.g, 8.3):
    • whatever AIO uses
  • Is this the first time you’ve seen this error? (Yes / No):
    • no
  • When did this problem seem to first start?
    • since installation a week or so ago
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • don't know what that is, but I don't think so.

Summary of the issue you are facing:

I am seeing a ton of:

ServerException
Server error: `POST http://nextcloud-aio-apache:23973/cool/convert-to/png` resulted in a `502 Bad Gateway` response

in the logs.

Steps to replicate it (hint: details matter!):

  1. not sure. But I assume it has to do with generating png files internally for something?

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

{"reqId":"BZLNXO8kyFvWl6gpHh2m","level":3,"time":"2025-11-17T17:13:20+00:00","remoteAddr":"10.1.10.21","user":"40942F33-437D-45D9-81F9-DAF09710F5E9","app":"richdocuments","method":"GET","url":"/core/preview?fileId=22134&x=250&y=250","message":"Failed to convert preview: Server error: `POST http://nextcloud-aio-apache:23973/cool/convert-to/png` resulted in a `502 Bad Gateway` response","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","version":"32.0.1.2","exception":{"Exception":"GuzzleHttp\\Exception\\ServerException","Message":"Server error: `POST http://nextcloud-aio-apache:23973/cool/convert-to/png` resulted in a `502 Bad Gateway` response","Code":502,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":72,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":209,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":158,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":52,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":251,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":227,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":272,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":229,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":69,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":189,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":277,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","*** sensitive parameters replaced ***",{"0":"And 2 more entries, set log level to debug to see all entries","verify":"/var/www/html/resources/config/ca-bundle.crt","timeout":5,"nextcloud":{"allow_local_address":true},"expect":false,"multipart":[{"name":"._Special 2025 Pricing Calculator for Hiperwall.xlsx","filename":"._Special 2025 Pricing Calculator for Hiperwall.xlsx","contents":null}]}]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Service/RemoteService.php","line":94,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Service/RemoteService.php","line":68,"function":"convertTo","class":"OCA\\Richdocuments\\Service\\RemoteService","type":"->","args":["._Special 2025 Pricing Calculator for Hiperwall.xlsx",null,"png"]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Preview/Office.php","line":43,"function":"convertFileTo","class":"OCA\\Richdocuments\\Service\\RemoteService","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},"png"]},{"file":"/var/www/html/lib/private/Preview/GeneratorHelper.php","line":45,"function":"getThumbnail","class":"OCA\\Richdocuments\\Preview\\Office","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},2048,2048]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":342,"function":"getThumbnail","class":"OC\\Preview\\GeneratorHelper","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Preview\\OOXML"},{"__class__":"OC\\Files\\Node\\File"},2048,2048]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":313,"function":"generateProviderPreview","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\SimpleFS\\SimpleFolder"},{"__class__":"OC\\Files\\Node\\File"},2048,2048,false,true,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",""]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":117,"function":"getMaxPreview","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\SimpleFS\\SimpleFolder"},"*** sensitive parameters replaced ***",{"__class__":"OC\\Files\\Node\\File"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",""]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":87,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},[{"width":250,"height":250,"crop":true,"mode":"fill"}],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",true]},{"file":"/var/www/html/lib/private/PreviewManager.php","line":161,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},250,250,true,"fill","*** sensitive parameters replaced ***",true]},{"file":"/var/www/html/core/Controller/PreviewController.php","line":166,"function":"getPreview","class":"OC\\PreviewManager","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},250,250,true,"fill"]},{"file":"/var/www/html/core/Controller/PreviewController.php","line":128,"function":"fetchPreview","class":"OC\\Core\\Controller\\PreviewController","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},250,250,false,true,"fill",false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":204,"function":"getPreviewByFileId","class":"OC\\Core\\Controller\\PreviewController","type":"->","args":[22134,250,250,false,true,"fill",false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\PreviewController","getPreviewByFileId",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"core.preview.getpreviewbyfileid"}]},{"file":"/var/www/html/lib/base.php","line":1061,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/html/index.php","line":25,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":111,"message":"Failed to convert preview: Server error: `POST http://nextcloud-aio-apache:23973/cool/convert-to/png` resulted in a `502 Bad Gateway` response","exception":[],"CustomMessage":"Failed to convert preview: Server error: `POST http://nextcloud-aio-apache:23973/cool/convert-to/png` resulted in a `502 Bad Gateway` response"},"id":"691b591c5d930"}

As stated above, getting a tone of errors in the logs that read:

ServerException
Server error: `POST http://nextcloud-aio-apache:23973/cool/convert-to/png` resulted in a `502 Bad Gateway` response

Any ideas on how to fix?

this url looks very suspicious.. I would expect https, your public FQDN and :443 there. In other posts you mentioned a reverse proxy.. did you try to setup internal connection to avoid an internet/proxy loop? if yes this is likely the culprit.

UPDATE: this might be a side effect from Configure WOPI requests to remain within the Docker network by asavageiv · Pull Request #6676 · nextcloud/all-in-one · GitHub and Use a fixed port for internal WOPI requests and callbacks by asavageiv · Pull Request #6825 · nextcloud/all-in-one · GitHub please post config and all possible logs

I read through that post, and I think maybe it is over my head. It looked like a fix (for whatever the issue was) was in beta on v11.8.0, but my installed version is 11.11.0.