add www redirect middlewares
This commit is contained in:
parent
ede328ec8e
commit
399fc729ac
1 changed files with 33 additions and 1 deletions
|
|
@ -6,4 +6,36 @@ metadata:
|
|||
spec:
|
||||
ipWhiteList:
|
||||
sourceRange:
|
||||
- 0.0.0.0/0
|
||||
- 0.0.0.0/0
|
||||
|
||||
---
|
||||
# Redirect no-www URLs to their www equivalent
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: redirect-no-www-to-www
|
||||
spec:
|
||||
# Redirect a request from an url to another with regex matching and replacement
|
||||
redirectRegex:
|
||||
# Apply a permanent redirection (HTTP 301)
|
||||
permanent: true
|
||||
# The regular expression to match and capture elements from the request URL
|
||||
regex: ^https?://(?:www\\.)?(.+)
|
||||
# How to modify the URL to have the new target URL
|
||||
replacement: https://www.${1}
|
||||
|
||||
---
|
||||
# Redirect www URLs to their no-www equivalent
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: redirect-www-to-no-www
|
||||
spec:
|
||||
# Redirect a request from an url to another with regex matching and replacement
|
||||
redirectRegex:
|
||||
# Apply a permanent redirection (HTTP 301)
|
||||
permanent: true
|
||||
# The regular expression to match and capture elements from the request URL
|
||||
regex: ^https?://www\\.(.+)
|
||||
# How to modify the URL to have the new target URL
|
||||
replacement: https://${1}
|
||||
Loading…
Add table
Reference in a new issue