City Traffic Long Exposure
David Mark via Pixabay
Home / Setting up Gitlab behind Traefik reverse proxy with Docker Labels
Self Hosting

Setting up Gitlab behind Traefik reverse proxy with Docker Labels

I had issues getting Gitlab to play nice with version 2 of the Traefik reverse proxy. This post shows how to set up the Docker container with the correct labels applicable for the new version.

My initial assumption that Traefik would forward requests to port 80 by default as this is the case for all my other containers. It turns out that Traefik will forward to the first port registered by the container.


Advertisement Begins

Advertisement End


In the case of Gitlab, this is the SSH port, giving a strange “Internal Server Error” notice or “Bad Gateway”. The solution is to specifically tell the proxy container to forward to port 80 using the last label shown below. I found the solution on this Stack Overflow question.

Gitlab Container Labels for Traefik v2

labels:
  - "traefik.enable=true"
  - "traefik.http.routers.gitlab.rule=Host(`gitlab.example.com`)"
  - "traefik.http.routers.gitlab.entrypoints=https"
  - "traefik.http.routers.gitlab.tls.certresolver=myhttpchallenge"
  - "traefik.http.services.gitlab.loadbalancer.server.port=80"

MY MISSION

This blog started nearly 10 years ago to help me document my technical adventures in home automation and various side projects. Since then, my audience has grown significantly thanks to readers like you.

While blog content can be incredibly valuable to visitors, it’s difficult for bloggers to capture any of that value – and we still have to work for a living too. There are many ways to support my efforts should you choose to do so:

Consider joining my newsletter or shouting a coffee to help with research, drafting, crafting and publishing of new content or the costs of web hosting.

It would mean the world if gave my Android App a go or left a 5-star review on Google Play. You may also participate in feature voting to shape the apps future.

Alternatively, leave the gift of feedback, visit my Etsy Store or share a post you liked with someone who may be interested. All helps spread the word.

BTC network: 32jWFfkMQQ6o4dJMpiWVdZzSwjRsSUMCk6

Continue your adventure here

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

DON’T MISS OUT!
Subscribe To Newsletter
Be the first to get latest updates and exclusive content straight to your email inbox.
Stay Updated
Give it a try, you can unsubscribe anytime.
close-link