Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Add PROTO headers

Andras Bacsai29d227857947
diff --git a/package.json b/package.json
index 89b194a51e..463479001b 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
- "version": "2.2.5",
+ "version": "2.2.6",
"license": "AGPL-3.0",
"scripts": {
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev",
diff --git a/src/lib/haproxy/configuration.ts b/src/lib/haproxy/configuration.ts
index b913d9044b..70e6502fc1 100644
--- a/src/lib/haproxy/configuration.ts
+++ b/src/lib/haproxy/configuration.ts
@@ -33,6 +33,7 @@ frontend http
bind :80
bind :443 ssl crt /usr/local/etc/haproxy/ssl/ alpn h2,http/1.1
acl is_certbot path_beg /.well-known/acme-challenge/
+
{{#applications}}
{{#isHttps}}
http-request redirect scheme https code ${
@@ -43,6 +44,7 @@ frontend http
dev ? 302 : 301
} if { req.hdr(host) -i {{redirectTo}} }
{{/applications}}
+
{{#services}}
{{#isHttps}}
http-request redirect scheme https code ${
@@ -53,6 +55,7 @@ frontend http
dev ? 302 : 301
} if { req.hdr(host) -i {{redirectTo}} }
{{/services}}
+
{{#coolify}}
{{#isHttps}}
http-request redirect scheme https code ${
@@ -63,6 +66,7 @@ frontend http
dev ? 302 : 301
} if { req.hdr(host) -i {{redirectTo}} }
{{/coolify}}
+
use_backend backend-certbot if is_certbot
use_backend %[req.hdr(host),lower]
@@ -82,6 +86,13 @@ backend backend-certbot
# updatedAt={{updatedAt}}
backend {{domain}}
option forwardfor
+ {{#isHttps}}
+ http-request add-header X-Forwarded-Proto https
+ {{/isHttps}}
+ {{^isHttps}}
+ http-request add-header X-Forwarded-Proto http
+ {{/isHttps}}
+ http-request add-header X-Forwarded-Host %[req.hdr(host),lower]
server {{id}} {{id}}:{{port}}
{{/isRunning}}
{{/applications}}
@@ -91,6 +102,13 @@ backend {{domain}}
# updatedAt={{updatedAt}}
backend {{domain}}
option forwardfor
+ {{#isHttps}}
+ http-request add-header X-Forwarded-Proto https
+ {{/isHttps}}
+ {{^isHttps}}
+ http-request add-header X-Forwarded-Proto http
+ {{/isHttps}}
+ http-request add-header X-Forwarded-Host %[req.hdr(host),lower]
server {{id}} {{id}}:{{port}}
{{/isRunning}}
{{/services}}
@@ -99,6 +117,13 @@ backend {{domain}}
backend {{domain}}
option forwardfor
option httpchk GET /undead.json
+ {{#isHttps}}
+ http-request add-header X-Forwarded-Proto https
+ {{/isHttps}}
+ {{^isHttps}}
+ http-request add-header X-Forwarded-Proto http
+ {{/isHttps}}
+ http-request add-header X-Forwarded-Host %[req.hdr(host),lower]
server {{id}} {{id}}:{{port}} check fall 10
{{/coolify}}
`;