Issue:
Hello, I have a Docker Compose file for frontend1. I want to configure it to handle all paths except those starting with sitemap or rss. However, for the frontend2 container, I only want it to respond to requests directed at the sitemap and rss paths.
Regex Patterns:
(www\.)?(foobar.com\/(?!(sitemap?.+|rss?.+)).+) - Handles all paths except sitemap and rss.
(www\.)?(foobar.com\/((sitemap?.+|rss?.+))) - Handles only sitemap paths.
Question:
I'm looking for advice on how to implement these regex patterns effectively within my Docker Compose configuration. Specifically, how can I ensure that frontend1 handles all paths except sitemap and rss, while frontend2 responds only to requests directed at the sitemap and rss paths?
Docker Compose Configuration:
frontend1:
image: docker.io/foxsnow/next-frontend:test
command: >
sh -c "npm run feb && npm run fen"
environment:
- NEXT_PUBLIC_SERVER_URL=$NEXT_PUBLIC_SERVER_URL
- NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL
networks:
- supabase
- bridge
labels:
- traefik.enable=true
- "traefik.http.routers.frontendsite.rule=Host(`foobar.com`) || Host(`www.foobar.com`)"
- traefik.http.routers.frontendsite.entrypoints=websecure
- traefik.http.routers.frontendsite.tls=true
- traefik.http.routers.frontendsite.tls.certresolver=myresolver
- traefik.http.routers.frontendsite.service=frontendsite
- traefik.http.services.frontendsite.loadbalancer.server.port=3001
- traefik.http.routers.frontendsite.middlewares=mywwwredirect
- traefik.docker.network=supabase
restart: always
frontend2:
image: docker.io/foxsnow/next-frontend:test
command: >
sh -c "npm run feb && npm run fens"
environment:
- NEXT_PUBLIC_SERVER_URL=$NEXT_PUBLIC_SERVER_URL
- NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL
networks:
- supabase
- bridge
labels:
- traefik.enable=true
- traefik.http.services.frontendsite.loadbalancer.server.port=3001
- traefik.docker.network=supabase
restart: always
Thanks:
Thank you in advance for any assistance or insights you can provide!
Note hat using sh in command will result in signals not being passed to the script running AFAIK. So if you run multiple instances and want a rolling update with graceful shutdown, this won’t work.
Hello @bluepuma77,
When I made like that sir - "traefik.http.routers.testsite.rule=Host(test.foobar.com) && !Path(/{sitemapath:(sitemap?.+|rss?.+)})"
I still can go to test.foobar.com/sitemap.xml
how is still happen ?
Thank you Sir.