https://supertokens.com/ logo
#support-questions
Title
# support-questions
s

Sami

10/14/2022, 8:53 AM
Hi Guys, Wondering if any one can help me host Supertokens behind a loadbalancer in AWS. I am getting this error when I try to set it up
r

rp

10/14/2022, 8:54 AM
hey @Sami
Seems like the loadbalance is misconfigured
do you see logs produced by supetokens at all?
when you query it via the loadbalancer
s

Sami

10/14/2022, 8:55 AM
No. It seems there is no handshake between LB and Supertokens instance
r

rp

10/14/2022, 8:56 AM
Hmm.
s

Sami

10/14/2022, 8:56 AM
I also tried adding NGINX container and proxying the request to Supertokens contianer
getting same error on Nginx too
r

rp

10/14/2022, 8:56 AM
well, there could be several reasons for this issue. Is the supertokens container reachanble without the loadbalancer in front?
s

Sami

10/14/2022, 8:59 AM
Yes. I can reach it directly without LB
browser => NGINX => Supertokens But this also does not work
r

rp

10/14/2022, 8:59 AM
is nginx running in a docker image?
s

Sami

10/14/2022, 8:59 AM
Yes
r

rp

10/14/2022, 9:00 AM
hmm. I think you would need to give the docker service name instead of 0.0.0.0
s

Sami

10/14/2022, 9:03 AM
Tried. Not working
r

rp

10/14/2022, 9:15 AM
hmm. there could be a lot of reasons for this. I need to know more about how you have setup the whole thing. For example, do you use docker-compose? If yes, can i see that?
s

Sami

10/14/2022, 9:15 AM
No. I started both the containers separately
r

rp

10/14/2022, 9:15 AM
oh then using supertokens won't work
then you need to give it the IP of your local LAN
using
supertokens:3567
would work if you used docker-compose and added them to the same docker network
s

Sami

10/14/2022, 9:17 AM
docker run --name supertokens -p 3567:3567 --env-file -d registry.supertokens.io/supertokens/supertokens-postgresql docker run -p 80:80 --name nginx -v ~/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
r

rp

10/14/2022, 9:18 AM
you should use the local LAN IP
s

Sami

10/14/2022, 9:18 AM
Should I use local lan Ip in nginx?
r

rp

10/14/2022, 9:19 AM
yes
s

Sami

10/14/2022, 9:19 AM
Then I am guessing same has to be done with the LB ?
r

rp

10/14/2022, 9:19 AM
i guess.. yea
s

Sami

10/14/2022, 9:23 AM
It worked for NGINX
But I guess it wont work for AWS LB
as AWS LB uses instance ID/ Private DNS to route traffic
r

rp

10/14/2022, 9:24 AM
yeaa.. that can be slighlty more complex
s

Sami

10/14/2022, 9:24 AM
Is there a way in Supertokens config to get around this?
r

rp

10/14/2022, 9:24 AM
maybe best to ask in aws support
i mean running supertokens with aws LB does work - we do it
I just don't recall what the AWS setting should be
s

Sami

10/14/2022, 9:25 AM
ok. Can you share the config of Supertokens for the same?
r

rp

10/14/2022, 9:25 AM
its just running the docker image as usual
nothing special
s

Sami

10/14/2022, 9:25 AM
got it