N8n API base URL for Digital Ocean VM

Describe the issue/error/question

I’d like to be able to construct the base URL and use the n8n API with my self-hosted instance of n8n and have tried port 5678, 80, and 443 because of this thread. But I’m still unable to reach even the Swagger docs using any variation of the URL construction using a domain+traeffic setup. Here are the URLs I’ve tried:

https://n8n.mysite.com:5678/root/n8n/api/v1/docs
https://n8n.mysite.com:80/root/n8n/api/v1/docs
https://n8n.mysite.com:443/root/n8n/api/v1/docs

What is the error message (if any)?

I keep getting unauthorized on 80 and 443 API calls using Postman and cannot 404s on accessing swagger docs. (Im running in root directory)

Information on your n8n setup

  • n8n version: 0.204.0
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker compose

Have you checked the DO firewall or local ufw blocking?

Yes I have ufw enabled with no additional firewall and allowed https access on port 443 using
sudo ufw allow https
but still doesn’t seem to work. Also same thing on port 80 using
sudo ufw allow http
Should I try using IP as the host instead of reverse proxy?

If you are using caddy - can you post that config here - usually the default works fine

Im actually using docker compose as described in this document: Docker Compose - n8n Documentation

Ok seems like that link is to use Traefick - I dont know anything about that so unable to help.
I use this docker instead Digital Ocean - n8n Documentation

Caddy is so much more easier - one line and you are done - unless you are using trafeick for other things, i would switch to caddy

Did you ever find the solution to this? I’m trying to run the “Get workflows affected by 0.214.3 migration” workflow from Get workflows affected by 0.214.3 migration | n8n workflow template but cannot get any base URL to work.

I am also using Docker Compose on a VM from a hosting provider (just not Digital Ocean).

Actually I figured out that the API endpoint is actually much simpler than this and does not require a port number if using reverse proxy. So in my case the Swagger docs were located at https://n8n.mysite.com/api/v1/docs

1 Like

Ahhhh thank you! Mine are there too!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.