https://www.growthbook.io/ logo
#announcements
Title
# announcements
b

brief-traffic-36675

05/19/2023, 8:34 PM
From inside the container:
Copy code
curl <http://localhost:3100>
{"name":"GrowthBook API","production":true,"api_host":"<http://localhost:3100>","app_origin":"<https://localhost:3000>","config_source":"db","email_enabled":false,"build":{"sha":"cf216ccc76a9d54e4bd793781e3e1d2e45385548","date":"2023-05-18T14:47:09Z"}}root@growthbook-api-web-685f59dbdf-fgxvn:/usr/local/src/app#
So why is the frontend unable to communicate with the API?
f

fresh-football-47124

05/20/2023, 1:45 AM
Are you getting a CORS error or any other message in console?
you can set an environment variable: CORS_ORIGIN_REGEX to match the domains GrowthBook is running on
b

brief-traffic-36675

05/20/2023, 6:19 AM
I mage the change that @happy-autumn-40938 suggested using
Copy code
APP_ORIGIN: <https://my.growthbook.mydomain.com>
        API_HOST: <https://my.growthbook.mydomain.com>
but now I am getting
The question is: the front end is trying to connect to the backend using the value of
API_HOST
? Is so, why is failing given that
<http://localhost:3100>
works from inside the pod?
f

fresh-football-47124

05/20/2023, 7:33 AM
using the same value for APP_ORIGIN and API_HOST wont work
it will send api request to itself - which will return html, as youโ€™re seeing there
I think you were very close to getting it to work
๐Ÿ’š 1
๐Ÿ™ 1
b

brief-traffic-36675

05/20/2023, 7:58 AM
So given that the instance is exposed at
<https://my.growthbook.mydomain.com>
what should the values for
API_HOST
/
APP_ORIGIN
be?
f

fresh-football-47124

05/20/2023, 9:06 PM
The API_HOST must be a routable address to the api container from the front end app. The APP_ORIGIN is used for the CORS headers to make sure the request from the front end is from the right host.
๐Ÿ‘ 1
9 Views