Second question for ya Artem, today when I navigat...
# dev-frontend
d
Second question for ya Artem, today when I navigate to
localhost:8000/connections
my browser navigates me to the
connections
tab. How does this work? I'm asking because we are hoping to serve up the webapp (index.html) via CDN for cloud and I want to make sure the routing behaviour is correct
Does this mean that everything hitting the cloud url, except for those with
/api
in the path, should be redirected to index.html?
l
when I navigate to 
localhost:8000/connections
 my browser navigates me to the 
connections
 tab. How does this work?
This is done by react router: https://github.com/airbytehq/airbyte/blob/master/airbyte-webapp/src/pages/routes.tsx#L124 Not sure this answers your question though, and how it relates to CDN.
👍 1
d
Mmm I'm wondering how react router does this exactly - it sounds like we'd have to make sure all the specific routes hit the index.html page
a
@Davin Chia (Airbyte) as its SPA - we should just route everything to index.html ( even if such routes are not found ). Routing is done then on client side.
d
Okay. Is this true for the
/api
routes as well?
Understanding is this is set by the following env vars now:
Copy code
API_URL=/api/v1/
INTERNAL_API_HOST=airbyte-server:8001
Thinking through how to keep this consistent. Will we need a separate api url then? e.g. if the main app is at
<http://dev-cloud.airbyte.io|dev-cloud.airbyte.io>
, we'll need
<http://dev-cloud-api.airbyte.io|dev-cloud-api.airbyte.io>
as the api endpoint so the webapp knows to redirect all
<http://dev-cloud.airbyte.io/api/v0|dev-cloud.airbyte.io/api/v0>
to
<http://dev-cloud-api.airbyte.io|dev-cloud-api.airbyte.io>
. Or is using the same url and redirecting all requests to
<http://dev-cloud.airbyte.io|dev-cloud.airbyte.io>
to the webapp, except for
<http://dev-cloud.airbyte.io/api|dev-cloud.airbyte.io/api>
, and setting this as an env var sufficient? Apologies if this is a basic question - been a while since I've done front end stuff
j
This is not true for API routes. All but API routes are directed to index.html
The additional config in the nginx config file is what prevents /api from being redirected to index.html and forwards it instead.
d
Oh great!
Makes it much easier
Thanks guys!
@Pavlo Palamarchuk looks like we want to route everything except
/api
to the webapp
1