I need to set up a http to https redirect.
I am unable to find a way to add he plugin.
I am new to this, so it could be something super silly that I am missing.
I have read the available documentation but that didn't help.
I need to set up a http to https redirect.
I am unable to find a way to add he plugin.
I am new to this, so it could be something super silly that I am missing.
I have read the available documentation but that didn't help.
You don’t need a plugin or middleware, this is build in, see entrypoints http redirection docs.
Thank you for you reply. Honestly I wasn't expecting anything. I have been though the docs and wasnt able to make use of them due to yaml, cli and toml. I have no clue where they are.
Well,
My browser often hits this. As you can see it will hit a 404 error page. But, it works when we replace http with https. That is want i am looking to do. Redirect it to https.
http://nextcloud.reachkushagra.com:9443/
Thank you for your reply.
When you don't share your configs, then we can just guess. If you don't get anything on http, then you probably don't have the router listen on your http entrypoint.
Thank you for your reply.
I don't mind sharing the configs but i don't know how to share it. I dont know how to access the config files, which would contain everything for sure.
But, i'll try to sum up in words.
nextcloud serviced at port 10443
Main is 9000
traefik 8080
web 80/tcp
websecure 9443
port exposed to the internet is 9443.
I was rather talking about your static and dynamic Traefik configuration and Docker - if it it used.
Example:
version: '3.9'
services:
traefik:
image: traefik:v2.9
ports:
- published: 80
target: 80
protocol: tcp
mode: host
- published: 443
target: 443
protocol: tcp
mode: host
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /root/traefik-certificates:/traefik-certificates
command:
--providers.docker=true
--providers.docker.network=proxy
--providers.docker.exposedByDefault=false
--entryPoints.web.address=:80
--entryPoints.web.http.redirections.entryPoint.to=websecure
--entryPoints.web.http.redirections.entryPoint.scheme=https
--entryPoints.websecure.address=:443
--entryPoints.websecure.http.tls=true
--api.debug=true
--api.dashboard=true
--log.level=DEBUG
--accesslog=true
--certificatesResolvers.myresolver.acme.email=mail@example.com
--certificatesResolvers.myresolver.acme.tlschallenge=true
--certificatesResolvers.myresolver.acme.storage=/traefik-certificates/acme.json
labels:
- traefik.enable=true
- traefik.http.routers.mydashboard.entrypoints=websecure
- traefik.http.routers.mydashboard.rule=Host(`traefik.example.com`)
- traefik.http.routers.mydashboard.tls.certresolver=myresolver
- traefik.http.routers.mydashboard.service=api@internal
- traefik.http.routers.mydashboard.middlewares=myauth
- traefik.http.middlewares.myauth.basicauth.users=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/
whoami:
image: traefik/whoami:v1.8
networks:
- proxy
labels:
- traefik.enable=true
- traefik.http.routers.mywhoami.entrypoints=websecure
- traefik.http.routers.mywhoami.rule=Host(`example.com`) || Host(`www.example.com`)
- traefik.http.routers.mywhoami.tls.certresolver=myresolver
- traefik.http.services.mywhoami.loadbalancer.server.port=80
networks:
proxy:
name: proxy
driver: overlay
attachable: true
I am on TrueNas Scale (truecharts).
Your configuration file looks so neat. I am sure that I would be able to control more parameters with these files.
But whatever you are saying is helping me in one way or other. I get some new keywords to hit on google.
Thank you for the prompt reply.
Even on TrueNAS the configuration has to be somewhere
Either it is embedded in a docker-compose.yml
like above (using command
and labels
) or you have separate files for Traefik static and dynamic configuration, those could be .yml
, .yaml
or .toml
files.
Right eh!
I have been talking to the TrueNAS folks as well, and they are like ---" they offer what is available through the GUI," and I somewhat don't buy it.
My biggest issue with them is that I have to manually dig deep into the sandbox when I have to edit a config file.
Sadly, I am not getting lucky this time. I have been struggling with this for over a month.
Check if your Traefik Truechart has some advanced text configuration, I saw some "advanced" buttons in the video.
You either need entryPoints
or routers
to configure the forward.
I have been trying things but nothing worked. It seems that whenever we are using port numbers with host names, it doesnot switch the port or rewrite the url.
So, for now i have resorted to using default http and https ports. They work out of the box.
But i will tray again after some time with some other method.
Sadly, Truenas is hiding too many things under the hood and I am no more liking it.
Thank you for your help.