Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Gateway & Reverse Proxy Addition #31

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

AlexaBrett
Copy link

@AlexaBrett AlexaBrett commented Apr 2, 2024

This adds Tyk as an api gateway to the app, cementing the microservice architecture. Also removes the dependancy on the .env.production as tyk & the stubs both run on the same port.

By default, the services are run behind TYK (used as an API Gateway & Reverse Proxy). Tyk is configured in the tyk folder, where each api has a config file (eg tyk/apps/auth). Here we configure which requests to tyk we match to this api, where we forward them on to and any middleware that is applied.

To access TYK, the frontend/orchestration needs to use an API Key. This is set as TYK_API_KEY in the .env for the frontend, and is set as a header on all requests to tyk. This means that all requests to our services are fully secured through auth, as requests can only get to the service via tyk, and the only way to get the api key is to send a request to the frontend/orchestration with a valid auth token.

If Tyk is giving errors in the logs like connect: connection refused, you may need to generate a new api key and place it in the env file for the frontend. To do this, use the cUrl command in the tyk folder, and paste the value of the "key" output as the api key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant