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