Hi @Jintawat_Tuitemwong, I just tried running n8n using docker run -it --rm -p 443:443 --name n8n -e N8N_PORT=443 n8nio/n8n:0.192.1 and the n8n container would listen on port 443 as expected (and also expose this port to the host through the -p 443:443 flag.
So I am unfortunately not able to reproduce your problem and n8n seems to work as expected here. Perhaps you can use the standard port inside the container and simply expose port 443 to your host instead?
You could run use -p 443:5678 instead (as in docker run -it --rm -p 443:5678 --name n8n n8nio/n8n:0.192.1). This way, the n8n container would use port 5678 internally, but you can still access n8n via port 443 (http://localhost:443/) of your host.
Perfect, so that’s the first step done. You can overwrite the OAuth redirect URL by setting the WEBHOOK_URLenvironment variable to the URL your n8n instance is publicly available under.
That solves a problem I have spent ca. 5 hours with, trying different reverse proxy, env. variable and container to host port settings.
Please include var WEBHOOK_URL in the documentation!
Background info:
I am using n8n in a Docker behind a reverse proxy (for third level domain) as well, and while no port is necessary for the test URL for webhooks, it was impossible for me to use the production URL of webhooks without port.
Eventually, not to have to use 5678 as port, I assigned 8443 to N8N_PORT since 443 did not work in the container (same problem as OP, it wasn’t listening/exposed) - maybe because of missing assigned certificate?
It worked for me with a production URL webhook including port 8443 (which is not nice, I’d like no port) with the settings shown in the attached images.
I just saw it - it’s just not that obvious - especially since it is not mentioned in the docker section. But that’s just a minor thing, I guess.
Sorry and thanks for replying!
Fair enough, while this is part of the docker compose documentation, it is not in docker part of the docs (which just gets n8n up and running without describing the setup around it).