Hi,
I'm trying deploy traefik as reverse proxy for tomcat geoserver.
The last time, i use nginx as reverse proxy for tomcat geoserver is good. I can access to my tomcat geoserver as like url : "https://mydomain/geo9c9t" with this nginx configuration:
Declare upstream server
upstream example_geoserver {
server 127.0.0.1:8080;
}
backend tomcat geoserver
location /geo9c9t {
proxy_read_timeout 600s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://example_geoserver/geo9c9t;
proxy_redirect http://example_geoserver/geo9c9t/ $scheme://$http_host/geo9c9t/;
}
But when change to traefik reverse proxy.
I deploy a docker stack as command:
docker stack deploy -c docker-compose-geoserver.yml geoserver
docker-compose-geoserver.yml as below:
version: "3.7"
services:
geoservice:
image: abcxxxxxyz/geoserver:v1.10
deploy:
replicas: 1
labels:
- "traefik.enable=true"
- "traefik.http.routers.geoservice.entrypoints=web"
- "traefik.http.routers.geoservice.rule= Host(mydomain
) && (PathPrefix(/geo9c9t/
))"
- "traefik.http.middlewares.geoservice.stripprefix.prefixes=/geo9c9t/,/"
- "traefik.http.routers.geoservice.middlewares=geoservice@docker"
- "traefik.http.services.geoservice.loadbalancer.server.port=8080"
- "traefik.http.services.geoservice.loadbalancer.sticky=true"
- "traefik.http.services.geoservice.loadbalancer.sticky.cookie.name=stickycookie"
# the following for https
- "traefik.http.services.geoservice.loadbalancer.sticky.cookie.secure=true"
- "traefik.http.routers.geoservice.entrypoints=websecure"
- "traefik.http.routers.geoservice.tls=true"
- "traefik.http.routers.geoservice.tls.certresolver=le"
restart_policy:
condition: on-failure
update_config:
delay: 2s
volumes:
- /home/tomcat/geoserver_data:/var/lib/geoserver_data
networks:
- test_net2
networks:
test_net2:
driver: overlay
external: true
But, now i can't access to geoserver via url : https://mydomain/geo9c9t as use nginx. i guest i have issue with redirect on http router of traefik on two line of docker-compose-geoserver.yml:
- "traefik.http.routers.geoservice.rule= Host(mydomain
) && (PathPrefix(/geo9c9t/
))"
- "traefik.http.middlewares.geoservice.stripprefix.prefixes=/geo9c9t/,/"
So, could you convert proxy pass and proxy redirect function on nginx to traefik on this case help me.
Thanks.