

but all use the same docker network, so they can be picked up by Traefik. I’ve used it with multiple directories too where each project runs on a different tech stack, uses different ports etc. This is to simplify the example and focus on Traefik and configuration.
Redirect shop login toweb how to#
I’m going to use a single docker compose file to demonstrate how to set up three web apps, Home, Shop and Showcase. How do we set up Traefik with Docker locally? Docker compose An easy reverse proxy like Traefik is a great solution for micro frontends or even just easier frontend and backend setup for single-page web apps and APIs. This solution allows for all your apps to run without explicit exposing ports, you just let Traefik know what port it should forward requests to and when it should send those requests to a particular app. This solves the port issue I described earlier. My favourite feature is the integration with Docker, it allows you to run all docker images and add some labels for configuration so Traefik can find them. The documentation is wonderful and easy to follow. Why I’ve had success with it comes down to ease of use. It receives requests on behalf of your system and finds out which components are responsible for handling them. Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience. Traefik proxy describes itself like this: It’s a problem for me though, so I was on the search for a better way and for local development, Traefik seems to fit the bill. If this isn’t a problem you care about, then Nginx is a great solution. The biggest issue I have with Nginx is that to get what we want, we still need to spin up our servers with unique ports, so they don’t conflict. It’s flexible, fast and has been my go-to tool for doing this job for a long time. Nginx is much more than just a reverse proxy, but for our purposes it would work pretty well. So, now we know we want a reverse proxy, what options do we have? Nginx From a user's perspective, this creates a cohesive experience and from a development perspective, each app can be isolated and use whatever technology we like. It’s precisely what we need to make sure when I visit localhost/shop the Shop web app responds to the request. What’s a reverse proxy?Ī server that sits in front of our web apps and forwards the requests to them.

This includes the docker-compose.yml file and the Deno server.

If you'd like to see the repository, it's on my GitHub - Darth-Knoppix/traefik-mfe-deno. We want to have these apps on the same domain and feel part of a cohesive experience. This works with 3, what about if it grows to 10 different apps? The other problem we run into is that the URL changes every time, you’ll go from localhost:8000 to localhost:8080 to wherever else. It means each app has to specify a port that it won’t conflict with other apps.
