2

I am attempting to use Traefik as a proxy to send traffic to gitlab review environments. Gitlab CI can start docker containers to run a review version of a project. I can get Traefik to detect these containers, and route trafic to them with this kind of config in my docker-compose file:

      - traefik.gitlab.frontend.rule=Host:gitlab.example.local;PathPrefixStrip:/review/$CI_BUILD_REF_NAME.$CI_PROJECT_NAME.$CI_PROJECT_NAMESPACE
      - traefik.gitlab.port=80

With this I can open "https://gitlab.example.local/review/master.project.user/ping", and get my PONG page. But if I go to "https://gitlab.example.local/review/master.project.user/", the simple test app I am using will return a 303 redirect to /ping which ends up as "https://gitlab.example.local/ping", and is not proxied to the review app.

> GET /review/master.10112.root HTTP/2
> Host: gitlab.example.local
> User-Agent: curl/7.54.0
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 303
< content-type: text/html; charset=utf-8
< date: Mon, 25 Feb 2019 08:25:44 GMT
< location: /ping
< content-length: 32
<
<a href="/ping">See Other</a>.

The documentation mentions a "X-Forwarded-Prefix" header being set. I'm not sure if it is actually set. I cant see this in a curl -V. Is it the case that I need to have an app that detects this header and prepends it as a "base path" to its responses? Is there a way to configure Traefik to add this to the returning path?

Are there any other more configurable Docker aware proxies out there that I could use to route traffic to dynamically addressed gitlab review environments?

1 Answer 1

0

You can tell GitLab where it's hosted so it sends the right redirect and links

docker run -e GITLAB_OMNIBUS_CONFIG="external_url 'https://gitlab.example.local/review/master.project.user/ping'" ... gitlab/gitlab-ce:latest

https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-a-relative-url-for-gitlab

1
  • Thanks. The "external_url" is set to "gitlab.example.local" now. I guess the problem is that the redirect is being sent by the application running in the review environment. That application doesn't have this kind of setting.
    – Ivan
    Commented Mar 14, 2019 at 0:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .