# StripPrefix is not working with https by sending the subpath as well

**URL:** https://community.traefik.io/t/stripprefix-is-not-working-with-https-by-sending-the-subpath-as-well/5053
**Category:** Traefik v2
**Tags:** docker
**Created:** [March 22, 2020, 5:02am UTC](https://community.traefik.io/t/stripprefix-is-not-working-with-https-by-sending-the-subpath-as-well/5053 "2020-03-22T05:02:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jaydevops](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jaydevops](https://community.traefik.io/u/jaydevops)
#### Post date: [March 22, 2020, 5:02am UTC](https://community.traefik.io/t/stripprefix-is-not-working-with-https-by-sending-the-subpath-as-well/5053/1 "2020-03-22T05:02:41Z")

</div>

The docker-compose file is as follows:  
Using traefik:latest  
traefik compose file:

```yaml
version: '3.5'
services:
  traefik:
    image: traefik:latest
    container_name: traefik
    networks:
      - "traefikvnet"
    command:
      #- --api.insecure=true
      - --api.dashboard=true
      - --api.debug=true
      - --providers.docker
        # setup dynamic config directory as /config volume
      - --providers.file.directory=/config
      - --providers.file.watch=true
        # setup http entrypoint on port 80
      - --entrypoints.web.address=:80
        # setup https entrypoint on port 9443
      - --entrypoints.websecure.address=:443
      #- --entrypoints.traefik.address=:8080
      - --log.filePath=/logs/traefik.log
      - --log.level=debug
      - --log.format=json
      - --accesslog=true
      - --accesslog.filepath=/logs/access.log
      - --accesslog.format=json
    labels:
      # catchall http -> https redirect
      - traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.http-catchall.entrypoints=web
      - traefik.http.routers.http-catchall.middlewares=redirect-to-https@docker
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
      - traefik.http.middlewares.redirect-to-https.redirectscheme.port=443
      - traefik.http.routers.traefikapi.rule=Host(`traefik.local.net`)
      - traefik.http.routers.traefikapi.service=api@internal
      - traefik.http.routers.traefikapi.tls=true
      #- traefik.http.routers.traefikapi.middlewares.auth.basicauth.users=test:mypasswordtoreplace

    ports:
        # http port
      - "80:80"
        # https port - backends to 443
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
        # config volume from this repo as readonly
      - ./config:/config:ro
        # adding volume containing ssl certs
      - ./certs:/certs:ro
        # adding volume for log files
      - ./logs:/logs
    restart: always

networks:
  traefikvnet:
    external:
      name: reverseproxyvnet

```

api-compose file

```yaml
version: "3.5"
services:
  myapi:
    image: jaydevops/myapi:latest
    env_file: 
      - "~/myapi/myenv.env"
    networks:
        - "traefikvnet"
    labels:
      - traefik.http.middlewares.myapistrip.stripprefix.prefixes=/myapi
      - traefik.http.middlewares.myapistrip.stripprefix.forceslash=false
      - traefik.enable=true
      - traefik.http.routers.myapi.entrypoints=websecure
      - traefik.http.routers.myapi.tls=true
      - traefik.http.routers.myapi.rule=Host(`api.local.net`) && PathPrefix(`/myapi`)
      - traefik.http.routers.myapi.middlewares=myapistrip
    restart: always

networks:
  traefikvnet:
  external:
    name: reverseproxyvnet

```

The examples works for subdomains that was built with no stripprfeix:  
web. & [logs.local.net](http://logs.local.net)  
[traefik.local.net/api/rawadata](http://traefik.local.net/api/rawadata)  
[traefik.local.net/dashboard/](http://traefik.local.net/dashboard/)

I used the following example code to build the secured.

> **[salderma/traefik-concept](https://github.com/salderma/traefik-concept)**
>
> Traefik Proof of Concept. Contribute to salderma/traefik-concept development by creating an account on GitHub.

  
Using the same cert for all domains as found in the above example.

Ironically, the whoami example is displaying stripped path.

What would make nodejs application, php applications not work?

#StripPrefix #TLS
