Loop login screen when use octoprint docker by haproxy

I setup 2 octoprint dockers for 2 printer in rpi4, all are fine when access directly by port (http://localhost:5000 and http://localhost:5001), but when I use haproxy (http://localhost/ce3pro and http://localhost/mtcxy), the login screen is loop infinity

So I believe the issue is the configuration of haproxy

Anyone can help me?

Thanks!

Following is the configuration file of haproxy and docker-compose

haproxy.cfg

global
        maxconn 4096
        user haproxy
        group haproxy
        log /dev/log local0 debug
        tune.ssl.default-dh-param 2048

defaults
        log     global
        mode    http
        compression algo gzip
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        option http-server-close
        option forwardfor
        maxconn 2000
        timeout connect 5s
        timeout client  15min
        timeout server  15min

frontend public
        bind :::80 v4v6
        #bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
        #use_backend ce3pro if { path_beg /ce3pro/ }
        use_backend ce3pro if { path /ce3pro } || { path_beg /ce3pro/ }
        #use_backend mtcxy if { path_beg /mtcxy/ }
        use_backend mtcxy if { path /mtcxy } || { path_beg /mtcxy/ }
        use_backend webcam if { path_beg /webcam/ }
        use_backend webcam_hls if { path_beg /hls/ }
        use_backend webcam_hls if { path_beg /jpeg/ }
        default_backend webcam

backend ce3pro
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
        #reqrep ^([^\ :]*)\ /ce3pro/(.*) \1\ /\2
        #reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        #reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        #reqadd X-Script-Name:\ /ce3pro
        http-request replace-path ^([^\ :]*)\ /ce3pro/(.*)      \1\ /\2
        #http-request replace-path ^([^\ :]*)\ /ce3pro(.*)      \1\ /\2
        http-request add-header X-Scheme https if needs_scheme { ssl_fc }
        http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }
        http-request add-header X-Script-Name /ce3pro
        option forwardfor
        server octprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend mtcxy
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
        #reqrep ^([^\ :]*)\ /mtcxy/(.*) \1\ /\2
        #reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        #reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        #reqadd X-Script-Name:\ /mtcxy
        #http-request replace-path ^([^\ :]*)\ /mtcxy/(.*)     \1\ /\2
        http-request replace-path ^([^\ :]*)\ /mtcxy(.*)     \1\ /\2
        http-request add-header X-Scheme https if needs_scheme { ssl_fc }
        http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }
        http-request add-header X-Script-Name /mtcxy
        option forwardfor
        server octprint2 127.0.0.1:5001
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        #reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        http-request replace-path ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

backend webcam_hls
        server webcam_hls_1 127.0.0.1:28126
        errorfile 503 /etc/haproxy/errors/503-no-webcam-hls.http

docker-compose.yml for first printer

version: '2.4'

services:
  ce3pro:
    container_name: ce3pro
    image: octoprint/octoprint
    restart: unless-stopped
    ports:
      - 5000:5000
      - 8080:8080
    devices:
      - /dev/ttyCE3PRO:/dev/ttyUSB0
#      - /dev/ttyUSB0:/dev/ttyUSB0
#      - /dev/video0:/dev/video0
    volumes:
      - /root/octoprint/ce3pro:/octoprint
    # uncomment the lines below to ensure camera streaming is enabled when
    # you add a video device
#    environment:
#      - ENABLE_MJPG_STREAMER=true
#      - CAMERA_DEV=/dev/video0
#      - MJPG_STREAMER_INPUT="-y -n -r 1280x960 -f 30

docker-compose.yml for second printer

version: '2.4'

services:
  mtcxy:
    container_name: mtcxy
    image: octoprint/octoprint
    restart: unless-stopped
    ports:
      - 5001:5000
      - 8081:8080
    devices:
      - /dev/ttyMTCXY:/dev/ttyUSB0
#      - /dev/ttyUSB1:/dev/ttyUSB0
#      - /dev/video2:/dev/video0
    volumes:
      - /root/octoprint/mtcxy:/octoprint
    # uncomment the lines below to ensure camera streaming is enabled when
    # you add a video device
#    environment:
#      - ENABLE_MJPG_STREAMER=true
#      - CAMERA_DEV=/dev/video0
#      - MJPG_STREAMER_INPUT="-y -n -r 1280x960 -f 30