Running behind traefik reverse proxy #317
|
Hi everyone, I'm trying to run the Problem is: A similar issue has been addressed in this post but I think the workaround proposed there (a) wouldn't work with Here is my I think the best solution would be to introduce a environment variable to the Has anyone made Let me know, if you need any more logs or data to assess. Thanks in advance |
Replies: 20 comments 8 replies
|
I have this in my nginx proxy config for my omada service. Not sure if you can get traefik to do something similar: # Add a proxy redirect because omada expects it and will redirect to the ssl port if
# it's not explicitly in the URL
proxy_redirect https://$http_host:$upstream_port/login https://$http_host/login;
proxy_buffering off;
# Add a few more headers to make Omada happy
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; |
|
Looking at the thread you linked, those connector properties in 3.2 are the equivalent of the values in the @gca3020 looks to be on to something. The |
|
Possibly |
|
The web behavior of V5 is different from the V4, I noticed that after I upgraded to the V5 the URI of the http request has changed and now includes the ID of the omadac. I'm also using Traefik but with a combination of static and dynamic configs. I've the Omadac in an LXC container but I'm using the Traefik in docker. The http request to the Omadac needs to have the Host header with the required https port, and the URI of the http request must be rewritten to include the omada instance ID. Here's the toml config I'm using, you can adapt it to docker labels. I tried to do a regex rule to automatically get the Omada id from the http response but didn't find a way to do it. You can get the Omadac ID from the logs, cat /opt/tplink/EAPController/logs/server.log | grep OmadacVO (main] [] c.t.s.o.s.t.OmadacInitTask(149): succeed get default omadac OmadacVO(id=b0f63ab3712f12c80658ece29d8ed9dc, name=wlc1) |
|
The only other ways I have found to get the controller ID are: From the From the API: |
|
@everyone: Thank you for your replies and hints. I'm going to be offline
for the next week and try them afterwards. Nonetheless it would be great
and much more straight forward if the redirect could be disabled.
CU
…On Wed, 19 Jan 2022 at 16:53, Matt Bentley ***@***.***> wrote:
The only other ways I have found to get the controller ID are:
From the Location: header on the login redirect:
$ curl -skI "https://omada.casa.mbentley.net/login" | grep "^Location: " | awk -F '/' '{print $4}'
f2c92c2a9b8fb0a427393f413bb16354
From the API:
$ curl -s "https://omada.casa.mbentley.net/api/info" | jq -r .result.omadacId
f2c92c2a9b8fb0a427393f413bb16354
—
Reply to this email directly, view it on GitHub
<#168 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUSYTH7HGIVECKC7VC4MEDUW3NAJANCNFSM5L4NPPUA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
I was able to achieve reverse proxying by setting "HTTPS Port for Controller Management:" in the web-UI to 443, then recreating the container with the host in a different port than the container I'm using Nginx Proxy Manager, not traefik, but it worked without any further configuration there (listens on port 443 and connect to the container in port 8043). Of course, I can't login directly on port 8043 anymore, but that is expected. |
|
I am going to close this for now since it seems like there are a few patterns that could work for people; feel free to reopen if you wish. If someone did want to submit a PR with a section on reverse proxy details for the README, we can add that. |
|
Just to add to this, the missing piece for me here was that my Omada server's SSL certificate was self-signed and therefore untrusted by Traefik. I had to add the following lines to my If you were using a configuration similar to @nickmaleao's, but got 500 errors, this might solve it. Other than that my configuration is very similar, just translated to use labels instead |
|
For anyone interested in the docker labels to get this working: replace all occurrences of |
Can you tell me how you changed the port in the UI? I did the same but the controller won't let me set it to less than 1024. I would really appreciate it if you could share screenshots of the Nginx Proxy Manager settings as I also use it for my containers. But I can't seem to get it to work with this particular container. |
I dont think this is the case with newer releases since the controller ID is added between the host and login |
|
Wanted to pass an FYI, this is my currently-working config as of V5 and Traefik v2: http:
routers:
rtr-omada:
entryPoints:
- websecure
rule: "Host(`omada.url.com`)"
service: svc-omada
middlewares:
- mid-omada-redirectRegex
- mid-omada-headers
tls:
certResolver: letsencrypt
services:
svc-omada:
loadBalancer:
servers:
- url: "https://omada.lan:8043"
middlewares:
mid-omada-redirectRegex:
redirectRegex:
regex: "^https:\\/\\/([^\\/]+)\\/?$"
replacement: "https://$1/controller_id/login"
mid-omada-headers:
headers:
customRequestHeaders:
host: "omada.url.com:8043"
customResponseHeaders:
host: "omada.url.comReplace Also unsure if it matters, but I have |
^^^ |
|
This thread was very helpful for me. Thank you. I'm using Traefik in k3s, so I had to make a few adjustments. Here is my Kubernetes config in case anyone wants it. There are two services, one for http and a second for the ports. The ports are exposed through the k3s Load Balancer. Note, it's also using a SSL cert too. |
|
is there a easy to spin up docker compose example with traefik and lets encrypt ? |
|
in system settings, I turned off "Redirect HTTP to HTTPS" + restarted the container, and that allows me to use my standard traefik config. |
|
Does anyone here have a current (v5/v6) compose file that uses traefik labels? |
|
you can no longer turn off the redirect to https, so I do it this way: in omada compose file: I replaced some parts in this example with xxxxxx and [ ] - replace those for your situation The hsts-on@file and skipverifytransport@file refer to the following section in traefik-options.yml, which I declare in the compose file for traefik itself - put the file in the folder you mount to /config in the traefik container: in the traefik compose: in traefik-options.yml: |
|
Got it workin with Traefik, omada-controller:6.2.14.11 and lets encrypt handling the certificate nonsense! :) |
Wanted to pass an FYI, this is my currently-working config as of V5 and Traefik v2: