Hi, also an API question, we have deployed gb in AWS ECS and want to use CloudFront to cache the API...
n
Hi, also an API question, we have deployed gb in AWS ECS and want to use CloudFront to cache the API, our setup is:
APP_ORIGIN: <http://growthbook.ourdomain.com|growthbook.ourdomain.com>
API_HOST: <http://growthbook.ourdomain.com:3100|growthbook.ourdomain.com:3100>
and then we have the CloudFront distribution created as
<http://growthbook-api.ourdomain.com|growthbook-api.ourdomain.com>
The issue now is that we cannot enter
<http://growthbook-api.ourdomain.com|growthbook-api.ourdomain.com>
into the API_HOST environment variable. I'm guessing that is because of the port mapping from container port to host port (or loadbalancer target to container even). As we also can't use any other port than 443 for CloudFront, we're currently not sure how to solve this. Do you have a working example for the GrowthBook API behind CloudFront?
f
API_HOST should contain the publicly accessible host not the internal ecs host, so https://growthbook-api.ourdomain.com in your example
n
We tried that, but then we get the error message
OAuth Error: Error Signing In
when accessing the UI. Only by providing
<http://growthbook.ourdomain.com:3100|growthbook.ourdomain.com:3100>
as API_HOST the setup works. We use Azure AD for SSO.
f
If you go to the CloudFront domain directly do you see a JSON object returned with status info about the API?
n
Yep, that works fine. The only 'issue' is that we cannot set the CloudFront url in the GB environment variables.
f
When you get the OAuth error, are there any other errors in the dev tools console? Like maybe CloudFront is not forwarding cors headers properly
n
So our users see the :3100 url when they look at the feature integration examples or the SDK example in the UI.
f
Oh, I think I was misunderstanding. So everything is working fine and the only thing you want to change is the domain shown in the code examples, is that right?
n
Correct.
f
Ok. We don't have an environment variable to override that yet, but it's easy to add. We do the same on GrowthBook Cloud to show cdn.growthbook.io in instructions. I'll create a github issue
❤️ 1
n
Awesome! Thank you :)