Hi all,
this is my first post here
I'm having trouble with redirection of my files in Traefik, and I'm hoping someone can help me out.
My task is to redirect
- from:
http(s)://(www.)openhdfpv.org/wp-content/openhd-images/BaseImages/*
- to:
https://data.openhdfpv.org/openhd-imagest/BaseImages/*
Here's what I'm running:
- WordPress in Docker Compose with Traefik2.9
- MinIO in a separate Docker Compose file
- I'm using the following labels:
labels:
traefik.enable: true
traefik.http.routers.wordpress-app.entrypoints: web
traefik.http.routers.wordpress-app.rule: Host(`www.openhdfpv.org`,`openhdfpv.org`)
traefik.http.middlewares.wordpress-app-https-redirect.redirectscheme.scheme: https
traefik.http.routers.wordpress-app.middlewares: wordpress-app-https-redirect,redirect-baseimages-to-data
traefik.http.routers.wordpress-app-secure.entrypoints: websecure
traefik.http.routers.wordpress-app-secure.rule: Host(`www.openhdfpv.org`,`openhdfpv.org`)
traefik.http.routers.wordpress-app-secure.tls: true
traefik.http.routers.wordpress-app-secure.tls.certresolver: myresolver
traefik.http.routers.wordpress-app-secure.service: wordpress-app
traefik.http.services.wordpress-app.loadbalancer.server.port: 80
traefik.docker.network: proxy
traefik.http.middlewares.redirect-baseimages-to-data.redirectregex.regex: ^https?://(www.)?openhdfpv\.org/wp-content/BaseImages/(.*)
traefik.http.middlewares.redirect-baseimages-to-data.redirectregex.replacement: https://data.openhdfpv.org/openhd-images/BaseImages/$${2}
traefik.http.middlewares.redirect-baseimages-to-data.redirectregex.permanent: true
The URL https://data.openhdfpv.org/openhd-images/BaseImages/hello.jpg works fine, but when I try to access https://openhdfpv.org/wp-content/BaseImages/hello.jpg, I get a 404 error.
I've tried a couple of things to fix this, but nothing seems to work. Here's what I've done so far:
- Checked that the regular expression and replacement in the
redirect-baseimages-to-data
middleware are correct. - Changed the order of middlewares
- Checked that the files are available on the target server at the correct location.
However, none of these solutions (that I remembered) have worked. I'm not sure what else to try. Does anyone have any ideas?
Thanks in advance for your help!