# redirectScheme returns URLs with port 80

**URL:** <https://community.traefik.io/t/redirectscheme-returns-urls-with-port-80/7612>\
**Category:** Traefik v2\
**Tags:** middleware, docker\
**Created:** [September 9, 2020, 10:05am UTC](https://community.traefik.io/t/redirectscheme-returns-urls-with-port-80/7612 "2020-09-09T10:05:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![geeks-r-us](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/geeks-r-us/32/2627_2.png) [@geeks-r-us](https://community.traefik.io/u/geeks-r-us)\
**Post date:** [September 9, 2020, 10:05am UTC](https://community.traefik.io/t/redirectscheme-returns-urls-with-port-80/7612/1 "2020-09-09T10:05:51Z")

</div>

Hi,

I user Traefik 2.2.11 with Docker to host about 15 of my projects.  
Everything works fine except of one container.

This one sometimes responds with a port number 80 even though the request was made over https port 443.

I setup a redirect-to-https file provider which is used by all my projects

```auto
 middlewares:
    redirect-to-https:
      redirectScheme:
        scheme: https
        permanent: true

```

The container in question uses the following labels:

```auto
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik_backend"
    
      - "traefik.http.routers.xentral_insecure.entrypoints=web"
      - "traefik.http.routers.xentral_insecure.rule=Host(`xentral.my.domain`)"
      - "traefik.http.routers.xentral_insecure.middlewares=redirect-to-https@file"
    
      - "traefik.http.routers.xentral.entrypoints=web-secure"
      - "traefik.http.routers.xentral.rule=Host(`xentral.my.domain`)"
      - "traefik.http.routers.xentral.tls.certresolver=default"
      - "traefik.http.services.xentral.loadbalancer.server.port=80"

```

When I request [https://xentral.my.domain/www/index.php](https://xentral.my.domain/www/index.php) sometimes it redirects me to  
[https://xentral.my.domain:80/www.index.php](https://xentral.my.domain:80/www.index.php) which of course does not exist.

Shouldn't redirectSchema also redirect this request from 80 to 443?

Do I need another extenstion to prevent such port issues?

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [September 9, 2020, 6:36pm UTC](https://community.traefik.io/t/redirectscheme-returns-urls-with-port-80/7612/2 "2020-09-09T18:36:28Z")

</div>

Hi @geeks-r-us,

From experience this is being returned from the app/container. You may require specific configuration for use behind a proxy.

---

<div class="post-metadata">

**Author:** ![geeks-r-us](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/geeks-r-us/32/2627_2.png) [@geeks-r-us](https://community.traefik.io/u/geeks-r-us)\
**Post date:** [September 23, 2020, 6:21pm UTC](https://community.traefik.io/t/redirectscheme-returns-urls-with-port-80/7612/3 "2020-09-23T18:21:27Z")

</div>

yes that's right. It's an application issue. I can add a url and port to the configuration but this ends up in a too many redirects message. The supports help on this issue was that there is also a hosted version for just 40€ a month extra. Not very helpfull....

It looks like they do not handle the X-Forward\* flags. And due to the php code is encrypted by ioncube I'm unable to add the handling it on code side by my self.

So what other options are available?

rewrite module ?  
configure apache to accept unencrypted traffic on port 443?

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [September 23, 2020, 11:23pm UTC](https://community.traefik.io/t/redirectscheme-returns-urls-with-port-80/7612/4 "2020-09-23T23:23:24Z")

</div>

This is really something that has to be untangled from the application end. If you can clearly articulate what you want traefik to do, we probably can tell you if it's possible or not. I personally do not see how configuring apache to accept unencrypted traffic on port 443 would help, but then you probably understand the problem better than I do.
