Dokploy / dokploy

Open Source Alternative to Vercel, Netlify and Heroku.
https://dokploy.com/
Other
6.55k stars 329 forks source link

redirect-to-https not working for apps deployed with Nixpacks #253

Closed simbrams closed 1 month ago

simbrams commented 1 month ago

To Reproduce

Hey, when deploying an app using Nixpacks, the https redirect is not workring and displays a 404 page not found.

The HTTPS route is working correctly.

Just when navigating using HTTP -> 404 page not found.

I tried both on a NextJS project and another project with basic html files, both have the issue.

Do you have an idea of the source of this issue ?

Thank you for your work!

Example link working: https://simulateur.twentysixpatrimoine.com/

Example 404 error: http://simulateur.twentysixpatrimoine.com/

image

Current vs. Expected behavior

Current: http address not redirecting to https and showing 404 page

Expected: should redirect to https

Provide environment information

Dokploy: v0.2.2
VPS Provider: Hetzner

Which area(s) are affected? (Select all that apply)

Application

Additional context

No response

lorenzomigliorero commented 1 month ago

Same here. Afaik, Traefik needs two routers, once for HTTP and HTTPS, otherwise can't catch the first request on :80.

bnussbau commented 1 month ago

can confirm this, although

middlewares:
  - redirect-to-https
entryPoints:
  - web
  - websecure

is added to config. I used Docker build.

lorenzomigliorero commented 1 month ago

I'm working on a PR. Temporary solution is to edit the traefik config with two routers:

routers:
  application-abc-router-1:
    rule: Host(`example.com`)
    service: application-abc-service-1
    entryPoints:
      - websecure
  application-abc-router-2:
    rule: >-
      Host(`example.com`) &&
      PathPrefix(`/`)
    service: application-abc-service-1
    middlewares:
      - redirect-to-https
    entryPoints:
      - web
simbrams commented 1 month ago

I'm working on a PR. Temporary solution is to edit the traefik config with two routers:

routers:
  application-abc-router-1:
    rule: Host(`example.com`)
    service: application-abc-service-1
    entryPoints:
      - websecure
  application-abc-router-2:
    rule: >-
      Host(`example.com`) &&
      PathPrefix(`/`)
    service: application-abc-service-1
    middlewares:
      - redirect-to-https
    entryPoints:
      - web

Nice workaround!