coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
34.52k stars 1.88k forks source link

[Bug]: Getting error ERR_TOO_MANY_REDIRECTS #3432

Open diogo24m opened 2 months ago

diogo24m commented 2 months ago

Description

I'm trying to run a meshcentral docker and when I access my domain I'm getting this error: ERR_TOO_MANY_REDIRECTS

Minimal Reproduction (if possible, example repository)

This is my docker-compose.yml:

version: '3'
services:
  meshcentral:
    container_name: meshcentral
    image: 'typhonragewind/meshcentral:latest'
    environment:
      - HOSTNAME=my.domain.com
      - REVERSE_PROXY=xxx.xx.xx.xx
      - REVERSE_PROXY_TLS_PORT=443
      - IFRAME=false
      - ALLOW_NEW_ACCOUNTS=true
      - WEBRTC=false
      - BACKUPS_PW=MyAwesomePasswordPleaseChangeMe
      - BACKUP_INTERVAL=24
      - BACKUP_KEEP_DAYS=7
    volumes:
      - './meshcentral/data:/opt/meshcentral/meshcentral-data'
      - './meshcentral/user_files:/opt/meshcentral/meshcentral-files'
      - './meshcentral/backups:/opt/meshcentral/meshcentral-backups'

With cloudflare dns configured like this: A | my.domain.com | xxx.xx.xx.xx | DNS only

Also tried forcing cloudflare to use SSL to connect to this domain

Exception or Error

Here you can see that meshcentral is running

MeshCentral HTTPS server running on my.domain.com:443.
Loaded web certificate from "https://xxx.xx.xx.xx:443", host: "my.domain.com"
  SHA384 cert hash: d109f2fd321973194fd3d6217bb12e4f1b0ef2c0451187b623401b825f07b512d83d91ba425bbfca94aab5d5b3832a01
  SHA384 key hash: 1f440cf88e68e2d5fc83b9eadcef3f72e7da061a62d4fe4d4632512774dfccfbd1b8ad1238e04335e21c951775b790d0

Version

v4.0.0-beta.333

Cloud?

steventsvetkov commented 2 months ago

@diogo24m By default, Cloudflare is configured to use a flexible SSL/TLS strategy, which means that connections between Cloudflare and your origin are made through HTTP. If your origin is using HTTPS, as it is in your case, that would cause such an issue as Cloudflare keeps trying to access your server via HTTP, which in turn keeps redirecting to HTTPS.

Make sure your SSL/TLS encryption mode is set to Full (strict).

image

If you have recently changed your record to be proxied by Cloudflare (or disabled that), that changes the A record target IP, which can take a while to propagate and is usually cached by your device/browser. After making the changes, give it some time or use a device which you have not recently used to access your website.

diogo24m commented 2 months ago

Is set like you said

image

steventsvetkov commented 2 months ago

The settings I'm talking about are located here:

image

I don't think it's necessary to set page rules.

diogo24m commented 2 months ago

I set it in Page Rules because I need other subdomains to have a different setting

dymoo commented 2 months ago

I use full (strict) and i'm still getting the same error. My own deployments (when I disable force https in advanced->general) work fine but all the templates i've deployed have the same too many redirects issue...

kunumigab commented 2 months ago

SSL need to be set to at least Full, and also disable "always https" on SSL/TLS>Edge Certificates.

Btw, if your using default proxy (traefik) you can setup DNS-01 for less LE errors issuing the certificate's

https://coolify.io/docs/knowledge-base/traefik/wildcard-certificates

diogo24m commented 2 months ago

"always https" is disabled

I only want to set this subdomain I am using.

My other apps and services are woking fine.

Fronix commented 1 month ago

There should be some type of setting in Coolify to disable forcing https redirects in the proxy. It's a good standard rule to have but it's messing up my setup... There was one before but it got removed in v4 :/

I can disable it by editing the coolify.yaml file etc but it gets reset everytime i restart or update

PinsonJonas commented 3 weeks ago

I'm trying to setup meshcentral as well and am encountering the same issue. Did you manage to figure it out?

diogo24m commented 3 weeks ago

Unfortunately no