# Setting up file-based redirect for reaching Subspace instance

**URL:** <https://community.traefik.io/t/setting-up-file-based-redirect-for-reaching-subspace-instance/6880>\
**Category:** Traefik v2\
**Tags:** file, docker\
**Created:** [July 13, 2020, 10:05am UTC](https://community.traefik.io/t/setting-up-file-based-redirect-for-reaching-subspace-instance/6880 "2020-07-13T10:05:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonszu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/simonszu/32/708_2.png) [@simonszu](https://community.traefik.io/u/simonszu)\
**Post date:** [July 13, 2020, 10:05am UTC](https://community.traefik.io/t/setting-up-file-based-redirect-for-reaching-subspace-instance/6880/1 "2020-07-13T10:05:02Z")

</div>

Hi,  
i am trying to set up an instance of Subspace. It is running in a docker container with host network mode. I already had success with setting up traefik file-based forwarder for an instance of Home Assistant on another host wich was also running in host network mode, so i just copied the configuration. Strangely for subspace traefik is _not_ doing the HTTPS redirection which worked for Home Assistant, so i am wondering what my problem is.

So in traefik.yaml i referenced the dynamic\_config.yaml as a file provider. This is the content of the file:

```auto
http:
  middlewares:
    auth:
      basicAuth:
        users:
          - "admin:XXXXX."
    redirect:
      redirectScheme:
        scheme: https
  routers:
    redirecttohttps:
      entrypoints:
        - http
      middlewares:
        - redirect
      rule: "HostRegexp(`{host:.+}`)"
      service: noop
    subspace:
      entrypoints:
        - https
      rule: "Host(`subspace.mydomain.tld`)"
      service: subspace
  services:
    # noop service, the URL will be never called
    noop:
      loadBalancer:
        servers:
          - url: "http://192.168.0.1"
    subspace:
      loadBalancer:
        servers:
          - url: "http://172.19.1.1:1234"

```

The section about the redirecttohttps is to automatically redirect every http request to https. This works for Home Assistant on the other host.

For reference, this is the docker compose i used for creating subspace:

```auto
  docker_container:
    name: subspace
    image: subspacecommunity/subspace:latest
    restart_policy: always
    capabilities:
      - NET_ADMIN
    network_mode: host
    env:
      SUBSPACE_LETSENCRYPT: "false"
      SUBSPACE_HTTP_ADDR: "0.0.0.0:1234"
      SUBSPACE_HTTP_HOST: "subspace.mydomain.tld"
    labels:
      traefik.enable: "true"
      traefik.http.routers.subspace.rule: "Host(`subspace.mydomain.tld`)"
      traefik.http.routers.subspace.entrypoints: "https"
      traefik.http.routers.subspace.service: "subspace"
      traefik.http.routers.subspace.tls.certresolver: "le"
      traefik.http.services.subspace.loadbalancer.server.port: "1234"
    volumes:
      - "/data/subspace:/data"
  become: yes

```

Please note that this is from an ansible command, so it slightly differs from vanilla docker compose.

However, the result is, that subspace.mydomain.tld is not redirecting to https when accessed, but homeassistant.mydomain.tld is. The only difference between both configs is the service name and the port in the dynamic\_config, and also the labels in the docker compose.

Maybe someone has an idea?
