Hi, is it possible to configure the frontend to ca...
# announcements
t
Hi, is it possible to configure the frontend to call API endpoints behind
/api
instead of on a separate port or subdomain? Tried out:
Copy code
APP_ORIGIN=<http://some.url.com>
API_HOST=<http://some.url.com/api/>
But the frontend seems to handle it inconsistently
f
Not that easily - I did help someone do it with a proxy server to do the redirecting for that use case
t
ah, so the the frontend still called the proxy server using a different port or subdomain?
f
ya, we used nginx for rewriting the requests
t
got it, I have a proxy set up to rewrite
/api
to the correct api port, but I'm just having trouble getting the frontend to actually call "/api" consistently. for example,
/init
call went to
/api/init
, but
/organization
and
/auth/refresh
did not
f
ya… ah
Copy code
fetch(getApiHost() + "/auth/refresh", {
that should append the right host
t
huh, yeah..
oh, ok I see. so
/api/init
is the thing that actually returns the api host env, but I wonder it's getting redirected to the api port because of my proxy
😄 so I should use any other redirect than "/api"
basing that off this:
f
ya
so thinking about it it, not sure this will work
t
going to try switching to
Copy code
API_HOST=<http://some.url.com/_api/>
f
since we overload the /api path if this hosts are the same
right
that could do it
since that api/init request is supposed to go to the front end container
👍 1
t
thanks @fresh-football-47124