Hello everyone, please help me to understand what is the problem.
I have a test deployment in Docker where Wordpress, Adminer for MariaDB, jlesage/handbrake and tutum/hello-world are behind Traefik 2.3.
Wordpress and Adminer work great, but jlesage/handbrake and tutum/hello-world are shown partially in browser. Here is the docker-compose file:
version: '3'
services:
reverse-proxy:
image: traefik
command: --providers.docker
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
db:
image: mariadb
restart: always
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: sql123
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
volumes:
- db_data:/var/lib/mysql
adminer:
depends_on:
- db
image: adminer
restart: always
labels:
- "traefik.http.routers.adminer.rule=Host(`docker.domain.local`) && PathPrefix(`/adminer`)"
wordpress:
depends_on:
- db
image: wordpress:latest
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: sql123
WORDPRESS_DB_NAME: wordpress
volumes:
- wp_data:/var/www/html
labels:
- "traefik.http.routers.wordpress.rule=Host(`docker.domain.local`)"
handbrake:
image: jlesage/handbrake
environment:
TZ: Europe/Moscow
CLEAN_TMP_DIR: 1
AUTOMATED_CONVERSION_KEEP_SOURCE: 0
volumes:
- ~/proj1/handbrake/config:/config:rw
- ~/proj1/handbrake/storage:/storage:ro
- ~/proj1/handbrake/watch:/watch:rw
- ~/proj1/handbrake/output:/output:rw
labels:
- traefik.http.routers.handbrake.rule=host(`docker.domain.local`) && PathPrefix(`/conv`)
- traefik.http.middlewares.handbrake.stripprefix.prefixes=/conv
- traefik.http.routers.handbrake.middlewares=handbrake
hello-world:
image: tutum/hello-world
labels:
- "traefik.http.routers.hello-world.rule=Host(`docker.domain.local`) && PathPrefix(`/hello`)"
volumes:
db_data: {}
wp_data: {}
This is how to web pages of hello-world and handbrake are shown:
Could you help me to resolve the problem?
zespri
September 30, 2020, 7:17am
2
If an application uses absolute references in asset links instead of relative and you strip prefix from url the application will end up not being able to load the assets because they are not where it thinks they are. If you want to host on the same domain but different prefix, there is not a whole lot you can do about that apart from asking for support for that use case from the application vendor.
1 Like
If I go to Handbrake page (docker.domain.local/conv), in the Traefik access log I see the following:
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /conv HTTP/1.1" 304 0 "-" "-" 1 "handbrake@docker" "http://172.19.0.6:5800" 10ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /css/bootstrap.min.css?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 2 "wordpress@docker" "http://172.19.0.5:80" 2ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /css/bootstrap.custom.css?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 3 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /js/jquery.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 4 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /js/jquery-ui.custom.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 5 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /js/jquery.ui.touch-punch.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 6 "wordpress@docker" "http://172.19.0.5:80" 2ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /js/bootstrap.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 7 "wordpress@docker" "http://172.19.0.5:80" 2ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /css/font-awesome.min.css?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 8 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /images/icons/master_icon.png?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 9 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /js/novnc-core.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 11 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:23 +0000] "GET /js/novnc-ui.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 10 "wordpress@docker" "http://172.19.0.5:80" 3ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /js/jquery-ui.custom.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 12 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /js/jquery.ui.touch-punch.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 13 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /js/bootstrap.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 14 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /css/bootstrap.min.css?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 15 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /css/bootstrap.custom.css?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 16 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /css/font-awesome.min.css?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 17 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /js/novnc-core.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 18 "wordpress@docker" "http://172.19.0.5:80" 2ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /js/novnc-ui.min.js?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 19 "wordpress@docker" "http://172.19.0.5:80" 1ms
192.168.1.10 - - [03/Oct/2020:05:45:24 +0000] "GET /images/icons/master_icon.png?v=68029c1cba HTTP/1.1" 404 272 "-" "-" 20 "wordpress@docker" "http://172.19.0.5:80" 1ms
The first query goes to the handbrake container and the rest goes to wordpress, why?
I found the root of the problem. If the URL is docker.domain.local/conv, the page is shown incorrectly. However, if you add slash to the end of the URL (docker.domain.local/conv/), everything is OK. The problem is nicely described here: https://stackoverflow.com/questions/41637806/routing-paths-with-traefik
- "traefik.http.routers.handbrake.rule=Host(`docker.domain.local`) && PathPrefix(`/conv`)"
- "traefik.http.routers.handbrake.middlewares=handbrake-redirectregex, handbrake-replacepathregex"
- "traefik.http.middlewares.handbrake-replacepathregex.replacepathregex.regex=^/conv/(.*)"
- "traefik.http.middlewares.handbrake-replacepathregex.replacepathregex.replacement=/$$1"
- "traefik.http.middlewares.handbrake-redirectregex.redirectregex.regex=^(.*)/conv$$"
- "traefik.http.middlewares.handbrake-redirectregex.redirectregex.replacement=$$1/conv/"
system
Closed
October 9, 2020, 7:06am
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.