-
Notifications
You must be signed in to change notification settings - Fork 9
Developer Guide
-
Why are we setting oAuth2.github.redirecturl config to
http://localhost:3000/api/v1/oauth2/github/callback
instead ofhttp://localhost:8080/api/v1/oauth2/github/callback
which has actual backend host and port?After the authentication on github completes the callback api is hit. In response of the callback api call we send a html response payload containing a javascript function that sets the token in local storage & redirects (using javascript) to
/
i.e. root location. So if we use backend redirect url, the javascript redirection will route us tohttp://localhost:8080
causing 404. To avoid this we have setup proxy in our frontend react application to route all the calls(ajax/non-ajax) having path prefix/api/v1
to be proxied to backend api server i.e.localhost:8080
This is why we redirect to
http://localhost:3000/api/v1/oauth2/github/callback
so that javascript will route us to/
which results inhttp://localhost:3000
and since ui is served from this location we get the home page on browser.This is a hack only for development environment. Since on kubernetes production instance the host for both api and ui is same. The ingress controller routes the ui and api requests to appropriate pod using configured rules