Skip to content

This repo contains code to demostrate how we can implement basic authentication in our apps using traefik proxy

Notifications You must be signed in to change notification settings

NashTech-Labs/basic-auth-using-traefik-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

MyApp with Traefik Reverse Proxy

This project sets up a simple Flask application (myapp) behind a Traefik reverse proxy with basic authentication.

Prerequisites

  • Docker and Docker Compose installed.

Project Structure

├── Dockerfile
├── docker-compose.yml
└── app.py

Configuration

docker-compose.yml

  • Traefik Service: Routes traffic, exposes ports 80 (HTTP) and 8080 (dashboard).
  • MyApp Service: Flask application with Traefik routing and basic authentication for users test and test2.

app.py

A simple Flask app with one route:

  • /home: Returns a welcome message.

Dockerfile

  • Base image: python:3.8-slim-buster.
  • Installs Flask and exposes port 4000.

Running the Application

  1. Clone the repository:

    git clone <repository-url>
    cd myapp
  2. Build and run:

    docker-compose up --build
  3. Access the Traefik dashboard at http://localhost:8080.

Accessing the Application

Visit http://example.com/home in your browser. Basic authentication is required.

About

This repo contains code to demostrate how we can implement basic authentication in our apps using traefik proxy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published