coolify: [Bug]: Https isn't enforced

Description

Traffic from HTTP isn’t automatically redirected to HTTPS. The option in the configuration under Advanced (Force HTTPS) is checked, and yet I can still access my app through HTTP. Is there something I might be misconfiguring? The domain in the general settings starts with https://.

I am also using V3, and I didn’t have this issue

Minimal Reproduction (if possible, example repository)

I am providing an example Docker Compose with network configuration:

version: ‘3’ services: probitapi: image: ‘ujstor/probitapi:1.0.4’ ports: - ‘5005:5005’ environment: - ‘KEY=${KEY}’ - ‘ID=${ID}’ - ‘SECRET=${SECRET}’ networks: t880g0g: null labels: - traefik.enable=true - traefik.http.middlewares.gzip.compress=true - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https - traefik.http.routers.http-0-p4c4k80.entryPoints=http - ‘traefik.http.routers.http-0-p4c4k80.rule=Host(probit.astipan.com) && PathPrefix(/)’ - traefik.http.routers.https-0-p4c4k80.entryPoints=https - traefik.http.routers.https-0-p4c4k80.middlewares=gzip - ‘traefik.http.routers.https-0-p4c4k80.rule=Host(probit.astipan.com) && PathPrefix(/)’ - traefik.http.routers.https-0-p4c4k80.tls.certresolver=letsencrypt - traefik.http.routers.https-0-p4c4k80.tls=true - ‘caddy_0.encode=zstd gzip’ - ‘caddy_0.handle_path.0_reverse_proxy={{upstreams}}’ - ‘caddy_0.handle_path=/*’ - caddy_0.header=-Server - ‘caddy_0.try_files={path} /index.html /index.php’ - ‘caddy_0=https://probit.astipan.com’ - caddy_ingress_network=p4c4k80 - coolify.managed=true - coolify.version=4.0.0-beta.239 - coolify.applicationId=1 - coolify.type=application - coolify.name=probitapi-t880g0g-222457280347 - coolify.pullRequestId=0 restart: unless-stopped container_name: probitapi-t880g0g-222457280347 volumes: { } networks: t880g0g: name: t880g0g external: true

Exception or Error

This is not the case with just one app. I deployed four different code examples, and in every case, I experienced the same issue. Was this previously known behavior?

Thanks for the help…project is amazing

Version

v4.0.0-beta.239

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 20 (4 by maintainers)

Most upvoted comments

In my case I solved this issue by:

  • disabling force https in coolify
  • enforce the HTTPS in cloudflare

still experience redirection issue using v4.0.0-beta.323. on Safari. only working on chrome. fix by disabling force https in coolify. use cloudflare redirection instead.

Do you happen to know how to disable force HTTPS for docker-compose or one-click deployments? I don’t find that option in those

Screenshot 2024-08-13 at 09 40 46 here is the menu located.

This is a single docker container, right? For docker compose or one click deployments, there are no Advanced tab at all: image

In my case I solved this issue by:

  • disabling force https in coolify
  • enforce the HTTPS in cloudflare

In my case I solved this issue by:

  • disabling force https in coolify
  • enforce the HTTPS in cloudflare

still experience redirection issue using v4.0.0-beta.323. on Safari. only working on chrome. fix by disabling force https in coolify. use cloudflare redirection instead.

Do you happen to know how to disable force HTTPS for docker-compose or one-click deployments? I don’t find that option in those

Screenshot 2024-08-13 at 09 40 46 here is the menu located.

Hi @andrasbacsai I am fairly new to coolify how do I regenerate the labels?

If you are using a compose based app, you need to click on the reload compose file button. image

For other apps: image

I can confirm this issue is happening to me too and it is actually quite critical, as basic auth doesnt seem to cover http, so even though my website is behind a basic auth, it can still be accessed through http from certain browsers such as iOS Safari, which opens you up to legal liability in some cases such as when you are not DSGVO compliant and expect your website to be hidden behind basic auth.

even with the traefik middleware label for the http-https redirect, some browsers will still be able to connect via http:// and that needs to be fixed asap

Browsers I found to be able to connect via http:// although the proper labels are set:

  • iOS Safari
  • Brave

Here, for reference, my docker-compose

services:
  *************:
    container_name: *************
    build:
      context: .
      dockerfile: ./docker/Dockerfile
      target: prod
    environment:
      NODE_ENV: production
      NEXT_PUBLIC_BACKEND_URL: '${NEXT_PUBLIC_BACKEND_URL}'
      NEXT_PUBLIC_HCAPTCHA_SITE_KEY: '${NEXT_PUBLIC_HCAPTCHA_SITE_KEY}'
    ports:
      - '3100:3100'
    labels:
      - 'traefik.http.middlewares.cplusbasicauth.basicauth.users=****:*********'
      - traefik.enable=true
      - traefik.http.middlewares.gzip.compress=true
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
      - traefik.http.routers.http-0-v4k4oko.entryPoints=http
      - 'traefik.http.routers.http-0-v4k4oko.rule=Host(`***********`) && PathPrefix(`/`)'
      - traefik.http.routers.https-0-v4k4oko.entryPoints=https
      - 'traefik.http.routers.https-0-v4k4oko.middlewares=gzip,cplusbasicauth'
      - 'traefik.http.routers.https-0-v4k4oko.rule=Host(`***********`) && PathPrefix(`/`)'
      - traefik.http.routers.https-0-v4k4oko.tls.certresolver=letsencrypt
      - traefik.http.routers.https-0-v4k4oko.tls=true
      - 'caddy_0.encode=zstd gzip'
      - 'caddy_0.handle_path.0_reverse_proxy={{upstreams}}'
      - 'caddy_0.handle_path=/*'
      - caddy_0.header=-Server
      - 'caddy_0.try_files={path} /index.html /index.php'
      - 'caddy_0=***********'
      - caddy_ingress_network=i4wwoc8
      - coolify.managed=true
      - coolify.version=4.0.0-beta.306
      - coolify.applicationId=3
      - coolify.type=application
      - coolify.name=frontend-i4wwoc8-112043614991
      - coolify.pullRequestId=0
    networks:
      i4wwoc8: null
    restart: unless-stopped
volumes: {  }
networks:
  i4wwoc8:
    name: i4wwoc8
    external: true