#Twenty behind NGINX reverse proxy

1 messages · Page 1 of 1 (latest)

elfin hound
#

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.

heavy cedar
#

Hi @elfin hound, 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?

elfin hound
#

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)

heavy cedar
elfin hound
#

it opens

heavy cedar
elfin hound
elfin hound
heavy cedar
#

Select "Other" and put your url

elfin hound
#

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

heavy cedar
#

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

elfin hound
#

oh i see

heavy cedar
#

From the REST point of view, here is the graphql domain:
const baseUrl = getServerUrl(
request,
this.environmentService.get('SERVER_URL'),
);

elfin hound
#

is there something i can do? Or just run two instances for now

heavy cedar
#

it should work, could you ssh into your container and tell me what SERVER_URL is ?

#

env | grep SERVER_URL

elfin hound
#

its the https domain

heavy cedar
#

does it include the protocol?

elfin hound
#

yes

heavy cedar
#

could you do a curl on this domain from your container?

elfin hound
#

the domain points to a private ip, but the server and the clients have access

#

here is the .env

heavy cedar
#

are you containerized?

elfin hound
#

its a ubuntu server running the docker image of twenty

heavy cedar
#

ok, could you curl from the docker image?

elfin hound
#

oh, maybe docker is the problem

heavy cedar
#

yes, I think your docker container cannot reach itself on this url

elfin hound
#

you have any idea how i can configure that?

#

im using the default docker compose file

heavy cedar
#

docker ps

elfin hound
heavy cedar
#

could you do docker ps?

elfin hound
heavy cedar
#

docker exec -it 39234c511f6df sh

#

then try to curl from there

elfin hound
#

ok, it loads forever

#

so how can i give docker access to this?

heavy cedar
#

I think that's the issue, why is your container not having access to the internet?

elfin hound
#

i have no idea, new to docker

heavy cedar
#

can you curl other urls from your docker?

elfin hound
#

no

#

now thats interesting

#

hahaha

#

well, then i just need to solve this connection

#

i think i got it from here

heavy cedar
#

yep, good luck 🙂

elfin hound
#

thank you so so much

heavy cedar
#

you are welcome

elfin hound
#

hey, just another question

#

the OPEN_AI keys at .envm do they do anything?

#

or they are just for the future

heavy cedar
#

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!)
elfin hound
#

nice

#

have a nice day

#

and thank you again

heavy cedar
#

you too