Skip to content

tobiasz-gleba/image-hosting-with-forwarded-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”’ Auth Forwarding Image Server

πŸš€ A lightweight Go server that authenticates requests through a remote server and serves static images from the file system.

Go Build
Docker Image

  • βœ… simple, secure access to local images based on external authentication πŸ”
  • βœ… supports .png, .jpg, and .jpeg formats πŸ–ΌοΈ
  • βœ… blazing fast with Go and zero dependencies 🏎️
  • βœ… customizable via environment variables πŸ› οΈ

πŸ›« How to use it?

  1. Place your image files into a directory mounted into the container (or accessible on host).
  2. Start the app with Docker:
docker run -p 8080:8080 \
-e AUTH_SERVER_BASE_URL="http://your-auth-server.local/auth" \
-v $(pwd)/images:/app/static \
ghcr.io/tobiasz-gleba/image-hosting-with-forwarded-auth

Now you can:

GET http://localhost:8080/cats/image1.jpg

And it will:

  • Forward request to: http://your-auth-server.local/auth/cats/image1.jpg
  • If 200 OK β†’ return cats/image1.png or .jpg or .jpeg
  • If not β†’ return 401 Unauthorized

πŸ”§ Available Environment Variables

AUTH_SERVER_BASE_URL=http://localhost:8081/auth
STATIC_DIR=/app/static

πŸ’‘ Use Cases

  • Private photo hosting
  • Auth-gated image previews
  • Secure image CDN

About

πŸ” The app that will serve the image, after forwarding the request and getting 200 response from another (auth server) app.

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors