Twenty behind NGINX reverse proxy
Im trying to self host Twenty using docker compose and NGINX. I just followed the tutorial in the page, and altered SERVER_URL at .env to be my domain. I can access the page and use the entire system with no problems. When i try to use the API, however, it times out every time.
If i change SERVER_URL back to localhost, the API works, but i can no longer access the web part using my domain (expected).
What im a missing? I tried changing FRONT_BASE_URL, but no effect.
47 Replies
Hi @Marcelo Granzotto, sorry for the slow answer. So Twenty is working fine but you cannot access the API on your_server_url/graphql?
could you share you network tab (browser developer console) while browsing twenty?
i cannot access the /rest API. In the browser everything works, but in a console it only works if i have twenty configured to be on localhost. My work around was to have two instances connected to the same DB
in the browser there is nothing weird. The API just does not work in the custom domain for me
the setup:
-NGINX for reverse proxy
-Twenty running with custom https domain
-The web UI works, the API does not (on any device, even local)
it opens
Could you try using: https://twenty.com/developers/rest-api/core#/
Twenty.com
Open Source CRM
here it just loads forever
Select "Other" and put your url
i will show you, just a sec
the only request that works is this first one /open-api. All the rest load forever, unless i use twenty at localhost
Ok!
I think I know where this come from
Right now the Rest API is leveraging the GraphqlAPI (we plan to change it later this year)... over HTTP
this means that when you make a /rest query, it is parsing it, making graphql and sending an http request to the /graphql endpoint
oh i see
From the REST point of view, here is the graphql domain:
const baseUrl = getServerUrl(
request,
this.environmentService.get('SERVER_URL'),
);
It's there: https://github.com/twentyhq/twenty/blob/0f75e14ab25f2893d288024db1ff7c616a6966d7/packages/twenty-server/src/engine/api/rest/rest-api.service.ts#L30
is there something i can do? Or just run two instances for now
it should work, could you ssh into your container and tell me what SERVER_URL is ?
env | grep SERVER_URL
its the https domain
does it include the protocol?
yes
could you do a curl on this domain from your container?
the domain points to a private ip, but the server and the clients have access
here is the .env
are you containerized?
its a ubuntu server running the docker image of twenty
ok, could you curl from the docker image?
oh, maybe docker is the problem
yes, I think your docker container cannot reach itself on this url
you have any idea how i can configure that?
im using the default docker compose file
docker ps
could you do docker ps?
docker exec -it 39234c511f6df sh
then try to curl from there
ok, it loads forever
so how can i give docker access to this?
I think that's the issue, why is your container not having access to the internet?
i have no idea, new to docker
can you curl other urls from your docker?
no
google.com fails
now thats interesting
hahaha
well, then i just need to solve this connection
i think i got it from here
Stack Overflow
My docker container has no internet
I had it working allright but now it stopped. I tried the following commands with no avail:
docker run -dns 8.8.8.8 base ping google.com
docker run base ping google.com
sysctl -w net.ipv4.ip_for...
yep, good luck 🙂
thank you so so much
you are welcome
hey, just another question
the OPEN_AI keys at .envm do they do anything?
or they are just for the future
not yet! we are exploring it to:
- make summaries for email conversations, query data with SQL, etc...
It's still ongoing exploration to see the potential and we will likely release something in 2025 (unless someone from the community is faster than us!)
nice
have a nice day
and thank you again
you too
no wo!