title: Traefik PathPrefix redirect to apache
body: <p>Hi I have Traefik set up in docker as reverse proxy.
  It works well until server tries to redirect to some url.
  ie.
  I have setup  services like this:</p>
  
  <blockquote>
    <p>docker-compose.yml</p>
  </blockquote>
  
  <pre><code>version: "3.4"
  
  services:
    php:
      image: 192.168.1.17/rab/php:latest
      networks:
        - backend
        - proxy
      labels:
        - "traefik.enable=true"
        - "traefik.backend=php"
        - "traefik.frontend.rule=Host:192.168.1.27"
        - "traefik.docker.network=proxy"
        - "traefik.port=9000"
      container_name: php
   apache:
     image: 192.168.1.17/rab/apache:latest
     networks:
       - proxy
     links:
       - php
     labels:
      - "traefik.enable=true"
      - "traefik.backend=apache"
      - "traefik.frontend.rule=Host:192.168.1.27; PathPrefixStrip:/rab;"
      - "traefik.docker.network=proxy"
      - "traefik.port=80"
      - "traefik.frontend.entryPoints=http"
      - "traefik.frontend.headers.SSLRedirect=false"
     container_name: apache
  networks:
    backend:
    proxy:
      external:
        name: traefik_proxy
  </code></pre>
  
  <p>So if I enter <a href="http://192.168.1.27/rab/login.php" rel="nofollow noreferrer">http://192.168.1.27/rab/login.php</a>, <strong>it works</strong> and the login page shows up. </p>
  
  <p>But, when I successfully login, it tries to redirect me to <a href="http://192.168.1.27/index.php" rel="nofollow noreferrer">http://192.168.1.27/index.php</a> instead of <a href="http://192.168.1.27/rab/index.php" rel="nofollow noreferrer">http://192.168.1.27/rab/index.php</a> and this does <strong>not work</strong></p>
  
  <p>The apache configuration is:</p>
  
  <pre><code>ServerName localhost
  
  LoadModule deflate_module /usr/local/apache2/modules/mod_deflate.so
  LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so
  LoadModule proxy_fcgi_module /usr/local/apache2/modules/mod_proxy_fcgi.so
  
  &lt;VirtualHost *:80&gt;
     # Proxy .php requests to port 9000 of the php-fpm container
     ProxyPassMatch ^(.*\.php(.*)?)$ fcgi://php:9000/var/www/html/$1  
     DocumentRoot /var/www/html/
     &lt;Directory /var/www/html/&gt;
         DirectoryIndex login.php
         Options Indexes FollowSymLinks
         AllowOverride All
         Require all granted
     &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>How to fix this?
  Please help</p>
  
  <p>Thanks</p>