On the old server, I had trouble getting WordPress to automatically publish scheduled posts. After many weeks of research, we discovered that the nginx proxy was preventing WordPress from calling itself via curl. We were able to solve this at the time by using extra_hosts in the docker-compose.yml file.
New server, new software, same problems? Instead of the nginx proxy, I’m now using Traefik. WordPress has been replaced by Ghost. But what’s not working again? Scheduled posts.
Error Message from Ghost
[2022-12-01 20:27:49] ERROR The server has encountered an error.
The server has encountered an error.
Error ID:
9fef2570-71b6-11ed-9df9-8d0ceb08a5f7
Error Code:
ECONNREFUSED
RequestError: connect ECONNREFUSED 192.168.32.3:443
at /var/lib/ghost/versions/5.24.1/core/server/adapters/scheduling/SchedulingDefault.js:319:23
at ClientRequest.
at Object.onceWrapper (node:events:628:26)
at ClientRequest.emit (node:events:525:35)
at ClientRequest.origin.emit (/var/lib/ghost/versions/5.24.1/node_modules/@szmarczak/http-timer/source/index.js:37:11)
at TLSSocket.socketErrorListener (node:_http_client:494:9)
at TLSSocket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Of course, it’s pretty safe to assume that the cause is similar to the problem I had with WordPress back then. But unfortunately, I can’t find a solution for how to loop the internal request back to Ghost. Traefik also seems to prioritize security here and doesn’t allow requests from a container back into the same container.
My luck: Unfortunately, other old services aren’t working with Traefik right out of the box either, and my administrator has decided that we’ll go back to the nginx proxy for now. At least until he has more time to take a closer look at it.
And lo and behold, after adding the extra_host to the docker-compose.yml, which redirects the URL to the internal IP address, scheduled posts are working again. It seems to be a common practice to send requests to your own script through the internet. I don’t get it, but there must be a reason for it.