I have a software package from a vendor that uses Jetty to provide web services. When I put Traefik infront of it and access the frontend I get redirected to the backend URL. For example the frontend URL is https://program.example.com/ and the backend (software) URL is http://192.168.1.1:8088/ when I browse to https://program.example.com/ i automatically get redirected to http://192.168.1.1:8088/. Thoughts?
[backends.sample]
[backends.sample.servers.sample]
url = "http://192.168.1.1:8088/"
[frontends.sample]
backend = "sample"
[frontends.sample.routes.sample]
rule = "Host:program.sample.com"
passHostHeader = true
useXForwardedFor = true
[frontends.sample.redirect]
entryPoint = "https"
permanent = true
I figured it out.
I had 'passHostHeader' in the wrong place.
[frontends.sample]
backend = "sample"
passHostHeader = true
[frontends.sample.routes.sample]
rule = "Host:program.sample.com"
useXForwardedFor = true
[frontends.sample.redirect]
entryPoint = "https"
permanent = true
Related
I have configured Traefik reverse proxy to connect to my application. When I hit my application directly (without any proxy) I am able to get all JS, CSS, HTML pages but if I try to connect to my application via Traefik reverse proxy I face MIME type error.
Basically Treafik proxy changes all content-type header values of response to text/plain value. I tried to change Traefik autodetect configuration to True and False but either of it didn't worked.
traefik.toml
defaultEntryPoints = ["http", "https"]
loglevel = "INFO"
[accessLog]
filePath = "access-log.log"
[log]
filePath = "traefik-log.log"
[tracing]
serviceName = "service_console"
# enable dashboard
[api]
dashboard = true
insecure = true
# Create entrypoint
[entryPoints]
[entryPoints.http]
address = ":8888"
# user file provider
[providers]
[providers.file]
filename = "traefik-dynamic.toml"
traefik-dynamic.toml
[http]
# Create route for http
[http.routers.router_console]
entryPoints = ["http"]
service = "service_console"
rule = "Path(`/`)"
# Create loadbalaner for serivces
[http.services]
[http.services.service_console.loadBalancer]
[[http.services.service_console.loadBalancer.servers]]
url = "https://172.18.80.32:1443/"
Please help to resolve this issue.
Thanks in advance.
Regards,
Rahul Kumbhar
I have installed gitlab-ce 13.2.0 on my server and the container-registry was immediately available.
from a other sever (or my local machine) I can login, but when pushing a image to the container-registry I get a 404-error: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE html>\n<html>\n<head>...
in my gitlab.rb I have:
external_url 'https://git.xxxxxxxx.com'
nginx['enable'] = true
nginx['client_max_body_size'] = '250m'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/trusted-certs/xxxxxxxx.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/trusted-certs/xxxxxxxx.com.key"
nginx['ssl_protocols'] = "TLSv1.1 TLSv1.2"
registry_external_url 'https://git.xxxxxxxx.com'
what is confusing, is that the registry_external_url is the same as the external_url. There are those lines in the gitlab.rb:
### Settings used by GitLab application
# gitlab_rails['registry_enabled'] = true
# gitlab_rails['registry_host'] = "git.xxxxxxxx.com"
# gitlab_rails['registry_port'] = "5005"
# gitlab_rails['registry_path'] = "/var/opt/gitlab/gitlab-rails/shared/registry"
But when I uncomment this, I cannot login.
what can be the problem here?
This is actually because you are using https port without proxying the registry in nginx.
Fix these lines according to the following in gitlab.rb:
registry_nginx['enable'] = true
registry_nginx['listen_https'] = true
registry_nginx['redirect_http_to_https'] = true
registry_external_url 'https://registry.YOUR_DOMAIN.gtld'
You don't need to touch nginx['ssl_*] parameters when you are using letsencrypt since the chef would take care.
How is your image named? Your image name must match exactly not only the registry URL, but project too.
You can't just build "myimage:latest" and push it. It must be like git.xxxxxxxx.com/mygroup/myproject:latest. You can obtain correct name from $CI_REGISTRY_IMAGE predefined variable.
Hey i am trying catch all request to an Subdomain, with no matching rool and redirect them to https://localhost:8000 without subdomain and suburl. But there is no redirect, i just get the response from the backend.
[file]
[frontends]
[frontends.homeRedirect]
entryPoints = ["https"]
priority = 1
backend = "homeRedirect"
[frontends.homeRedirect.routes.everything]
rule = "PathPrefix:/"
[frontends.homeRedirect.headers]
SSLRedirect = true
[frontends.homeRedirect.redirect]
regex = "(.*)"
replacement = "https://localhost:8000"
[backends]
[backends.homeRedirect]
[backends.homeRedirect.servers]
[backends.homeRedirect.servers.server0]
url = "http://frontend:80"
Is there something wrong with my file?
In this case, a redirect on the entry point is more appropriate:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
regex = "^http://subdomain.mydomain/(.*)"
replacement = "http://myotherdomain/$1"
https://docs.traefik.io/v1.5/configuration/entrypoints/#rewriting-url
localhost inside the Traefik container is the container not the real machine.
Having read https://github.com/containous/traefik/issues/751 and https://github.com/containous/traefik/pull/1147 that are mentioning traefik.frontend.auth.basic I'm trying to set basic auth per traefik frontend (not entrypoint).
Neither
[frontends.kibana]
backend = "kibana"
[frontends.kibana.routes.nas]
rule = "Host:kibana.mydomain.io"
[frontends.kibana.auth]
basic = "kibana:$apr1$cHAIJt0o$..."
nor
[frontends.kibana]
backend = "kibana"
auth.basic = "kibana:$apr1$cHAIJt0o$..."
[frontends.kibana.routes.nas]
rule = "Host:kibana.mydomain.io"
is working. How can I specify basic auth on frontend level?
Like that:
[frontends.kibana]
backend = "kibana"
basicAuth = ["kibana:$apr1...", "anabik:$apr1..."]
[frontends.kibana.routes.nas]
rule = "Host:kibana.mydomain.io"
I'm starting using traefik for blue/green deployment. I would like to use the REST API, so I have to put my configuration in the [web] section:
[web]
address = ":8080"
readOnly = false
[backends]
[backends.back]
[backends.back.loadbalancer.stickiness]
cookieName = "backend"
[backends.back.servers.S000]
url = "http://HOST_IP_ADDRESS:30000"
weight = 1
[backends.back.servers.S001]
url = "http://HOST_IP_ADDRESS:30001"
weight = 1
[frontends]
[frontends.front]
backend = "back"
passHostHeader = true
But it's not initialized with those values. However if I use PUT to http://localhost:8091/api/providers/web I can see the web provider OK. And if I use this same configuration for [file] it works right (but I'm unable to update it via API)
Is there any web to initialize [web] backends/frontends?
web section is deprecated.
try this:
# Enable API and dashboard
[api]
# Name of the related entry point
entryPoint = "traefik"
# Enabled Dashboard
dashboard = true