Skip to content

Instantly share code, notes, and snippets.

@abdennour
Created May 27, 2022 10:46
Show Gist options
  • Save abdennour/125da72f36aa7d577cb9045f19074f25 to your computer and use it in GitHub Desktop.
Save abdennour/125da72f36aa7d577cb9045f19074f25 to your computer and use it in GitHub Desktop.
Redirect all HTTP to HTTPS - Ingress Traefik k3s
@abdennour
Copy link
Author

IN case, the LINK is no more available, this is its content as per today:

Here are the details for the way proposed by dywan666:

  1. Login on your k3s server via ssh
  2. Open /var/lib/rancher/k3s/server/manifests/traefik.yaml
  3. Add ports.web.redirectTo: websecure as shown here:

image of the config file

  1. Can can now see that k3s automatically re-ran the helm-install-treafik job

screenshot of rancher ui with the job

  1. Now I recommend you verify with curl that the redirect is enforced:

curl -v http://my.web.app

It should look like this:

*   Trying 1.2.3.4:80...
* TCP_NODELAY set
* Connected to my.web.app (1.2.3.4) port 80 (#0)
> GET / HTTP/1.1
> Host: my.web.app
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Location: https://my.web.app/
< Date: Wed, 13 Apr 2022 08:24:47 GMT
< Content-Length: 17
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host my.web.app left intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment