File tree 3 files changed +66
-0
lines changed
3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 22
22
stsIncludeSubdomains : true
23
23
stsPreload : true
24
24
forceSTSHeader : true
25
+
26
+ # Redirect non-www URLs to their www equivalent
27
+ # Use with traefik.http.routers.myRouter.middlewares: "redirect-non-www-to-www@file"
28
+ # Source: https://www.benjaminrancourt.ca/how-to-redirect-from-non-www-to-www-with-traefik/
29
+ redirect-non-www-to-www :
30
+ # Redirect a request from an url to another with regex matching and replacement
31
+ redirectregex :
32
+ # Apply a permanent redirection (HTTP 301)
33
+ permanent : true
34
+ # The regular expression to match and capture elements from the request URL
35
+ regex : " ^https?://(?:www\\ .)?(.+)"
36
+ # How to modify the URL to have the new target URL
37
+ replacement : " https://www.${1}"
38
+
39
+ # Redirect www URLs to their non-www equivalent
40
+ # Use with traefik.http.routers.myRouter.middlewares: "redirect-www-to-non-www@file"
41
+ # Source: https://www.benjaminrancourt.ca/how-to-redirect-from-non-www-to-www-with-traefik/
42
+ redirect-www-to-non-www :
43
+ # Redirect a request from an url to another with regex matching and replacement
44
+ redirectregex :
45
+ # Apply a permanent redirection (HTTP 301)
46
+ permanent : true
47
+ # The regular expression to match and capture elements from the request URL
48
+ regex : " ^https?://www\\ .(.+)"
49
+ # How to modify the URL to have the new target URL
50
+ replacement : " https://${1}"
Original file line number Diff line number Diff line change 22
22
stsIncludeSubdomains : true
23
23
stsPreload : true
24
24
forceSTSHeader : true
25
+
26
+ # Redirect non-www URLs to their www equivalent
27
+ # Use with traefik.http.routers.myRouter.middlewares: "redirect-non-www-to-www@file"
28
+ # Source: https://www.benjaminrancourt.ca/how-to-redirect-from-non-www-to-www-with-traefik/
29
+ redirect-non-www-to-www :
30
+ # Redirect a request from an url to another with regex matching and replacement
31
+ redirectregex :
32
+ # Apply a permanent redirection (HTTP 301)
33
+ permanent : true
34
+ # The regular expression to match and capture elements from the request URL
35
+ regex : " ^https?://(?:www\\ .)?(.+)"
36
+ # How to modify the URL to have the new target URL
37
+ replacement : " https://www.${1}"
38
+
39
+ # Redirect www URLs to their non-www equivalent
40
+ # Use with traefik.http.routers.myRouter.middlewares: "redirect-www-to-non-www@file"
41
+ # Source: https://www.benjaminrancourt.ca/how-to-redirect-from-non-www-to-www-with-traefik/
42
+ redirect-www-to-non-www :
43
+ # Redirect a request from an url to another with regex matching and replacement
44
+ redirectregex :
45
+ # Apply a permanent redirection (HTTP 301)
46
+ permanent : true
47
+ # The regular expression to match and capture elements from the request URL
48
+ regex : " ^https?://www\\ .(.+)"
49
+ # How to modify the URL to have the new target URL
50
+ replacement : " https://${1}"
Original file line number Diff line number Diff line change @@ -178,6 +178,20 @@ The `max-age` is set to one year / 31536000 seconds.
178
178
179
179
Adds a permanent redirect to HTTPS.
180
180
181
+ **redirect-non-www-to-www@file**
182
+
183
+ Adds a permanent redirect (HTTP 301) from non-www domains to the HTTPS www domain
184
+ Examples :
185
+ - ` https://example.test` -> `https://www.example.test`
186
+ - ` http://example.test` -> `https://www.example.test`
187
+
188
+ **redirect-www-to-non-www@file**
189
+
190
+ Adds a permanent redirect (HTTP 301) from www domains to the HTTPS non-www domain
191
+ Examples :
192
+ - ` https://www.example.test` -> `https://example.test`
193
+ - ` http://www.example.test` -> `https://example.test`
194
+
181
195
# ## Access Logs
182
196
183
197
To enable the traefik access logs in the production configuration, open the file `traefik.yml` within the config folder and uncomment the `accessLog` section.
You can’t perform that action at this time.
0 commit comments