Disable HTTP to HTTPS redirection
Hello, is there a way to disable HTTP to HTTPS redirection? I already have the reverse proxy dealing with the SSL/HTTPS so I don't really need redmail to do it.
http -> https redirection is configured in /etc/nginx/sites-enabled/00-default.conf.
#
# This file is managed by iRedMail Team <[email protected]> with Ansible,
# please do __NOT__ modify it manually.
#
# Note: This file must be loaded before other virtual host config files,
# HTTP
server {
listen 80;
#listen [::]:80;
server_name _;
index index.php index.html;
include /etc/nginx/templates/misc.tmpl;
# Load modular config files
include /etc/nginx/templates/roundcube-homepage.tmpl;
root /opt/www/roundcubemail;
}
i've tried this but now redmail doesn't start
iredmail | 2022-12-28 04:49:13,148 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:13,166 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:14,169 INFO spawned: 'nginx' with pid 1220
iredmail | 2022-12-28 04:49:14,187 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:14,187 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:15,191 INFO spawned: 'nginx' with pid 1227
iredmail | 2022-12-28 04:49:15,210 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:15,212 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:16,216 INFO spawned: 'nginx' with pid 1234
iredmail | 2022-12-28 04:49:16,232 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:16,234 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:17,239 INFO spawned: 'nginx' with pid 1241
iredmail | 2022-12-28 04:49:17,257 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:17,259 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:18,154 INFO spawned: 'nginx' with pid 1249
iredmail | 2022-12-28 04:49:18,173 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:18,174 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:18,178 INFO spawned: 'nginx' with pid 1252
iredmail | 2022-12-28 04:49:18,179 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:18,196 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:19,199 INFO spawned: 'nginx' with pid 1259
iredmail | 2022-12-28 04:49:19,218 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:19,220 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:20,224 INFO spawned: 'nginx' with pid 1266
iredmail | 2022-12-28 04:49:20,243 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:20,244 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:21,248 INFO spawned: 'nginx' with pid 1273
iredmail | 2022-12-28 04:49:21,269 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:21,270 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:21,272 INFO spawned: 'nginx' with pid 1276
iredmail | 2022-12-28 04:49:21,288 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:21,290 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:22,295 INFO spawned: 'nginx' with pid 1283
iredmail | 2022-12-28 04:49:22,311 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:22,313 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:23,179 INFO spawned: 'nginx' with pid 1291
iredmail | 2022-12-28 04:49:23,212 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:23,214 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:23,259 INFO spawned: 'nginx' with pid 1294
iredmail | 2022-12-28 04:49:23,272 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:23,279 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:23,283 INFO spawned: 'nginx' with pid 1299
iredmail | 2022-12-28 04:49:23,285 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:23,287 INFO exited: clamav-daemon (exit status 1; not expected)
iredmail | 2022-12-28 04:49:23,289 INFO spawned: 'clamav-daemon' with pid 1300
iredmail | 2022-12-28 04:49:23,298 INFO success: clamav-daemon entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:23,300 INFO exited: nginx (exit status 1; not expected)
iredmail | 2022-12-28 04:49:23,311 INFO spawned: 'nginx' with pid 1304
iredmail | 2022-12-28 04:49:23,312 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
iredmail | 2022-12-28 04:49:23,327 INFO exited: nginx (exit status 1; not expected)
Run nginx -t to make sure Nginx config files are correct.
Running into a similar issue. I'm currently trying to deploy this Docker image behind my Traefik reverse proxy and I'm having difficulties doing so. When I route it to port 80 it tries redirecting to https despite already being https. And when I try to route it directly to port 443 of the Container it complains that it's receiving a plain http request and not a https.
I've edite the 00-default.conf by copying most of the lines out of 00-default-ssl.conf and commenting some lines out.
Now I'm running into the issue of getting ERR_TOO_MANY_REDIRECTS in my Browser with no idea why it's still trying to redirect.
Here's the content of the 00-default.conf
#
# This file is managed by iRedMail Team <[email protected]> with Ansible,
# please do __NOT__ modify it manually.
#
# Note: This file must be loaded before other virtual host config files,
# HTTP
server {
listen 80;
#listen [::]:80;
server_name _;
index index.php index.html;
include /etc/nginx/templates/misc.tmpl;
# include /etc/nginx/templates/ssl.tmpl;
# Load modular config files
# include /opt/iredmail/custom/nginx/sites-conf.d/default-ssl/*.conf;
# include /etc/nginx/sites-conf.d/default-ssl/*.conf;
include /etc/nginx/templates/roundcube-homepage.tmpl;
root /opt/www/roundcubemail;
}
Sadly I am not knowledgeable enough with nginx to know where to really look to fix this redirection issue.
As for my case, I wasn't able to figure out a solution to deactivating the redirection but I did figure out, that I can tell Traefik to just forward the Request to the Container using https, which works perfectly fine for my use case.
These are the labels I have used, in case someone else stumbles across the issue I had.
traefik.http.services.iredmail.loadbalancer.server.port=443
traefik.http.services.iredmail.loadbalancer.server.scheme=https
As for my case, I wasn't able to figure out a solution to deactivating the redirection but I did figure out, that I can tell Traefik to just forward the Request to the Container using https, which works perfectly fine for my use case.
These are the labels I have used, in case someone else stumbles across the issue I had.
traefik.http.services.iredmail.loadbalancer.server.port=443 traefik.http.services.iredmail.loadbalancer.server.scheme=https
I have the exact same issue, but SmollClover' sollution doesn't work for me.
I run IRedMail using docker compose as portrayed below: docker-compose.yaml
version: '3.5'
networks:
web:
external: true
internal:
external: false
services:
iredmail:
image: iredmail/mariadb:stable
restart: unless-stopped
hostname: xxx
container_name: iredmail
environment:
- HOSTNAME=xxx
- MYSQL_ROOT_PASSWORD=xxx
- SOGO_WORKERS=1
- TIMEZONE=xxx
- POSTMASTER_PASSWORD=xxx
- FIRST_MAIL_DOMAIN=xxx
- FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=xxx
- MLMMJADMIN_API_TOKEN=xxx
- ROUNDCUBE_DES_KEY=xxx
volumes:
- /iredmail/data/backup-mysql:/var/vmail/backup/mysql
- /iredmail/data/mailboxes:/var/vmail/vmail1
- /iredmail/data/mlmmj:/var/vmail/mlmmj
- /iredmail/data/mlmmj-archive:/var/vmail/mlmmj-archive
- /iredmail/data/imapsieve_copy:/var/vmail/imapsieve_copy
- /iredmail/data/custom:/opt/iredmail/custom
- /iredmail/data/ssl:/opt/iredmail/ssl
- /iredmail/data/mysql:/var/lib/mysql
- /iredmail/data/clamav:/var/lib/clamav
- /iredmail/data/sa_rules:/var/lib/spamassassin
- /iredmail/data/postfix_queue:/var/spool/postfix
ports:
- 25:25
- 587:587
- 110:110
- 143:143
- 993:993
- 995:995
networks:
- internal
- web
labels:
- traefik
- traefik.http.routers.iredmail.rule=Host(`xxx`)
- traefik.http.routers.iredmail.tls=true
- traefik.http.routers.iredmail.tls.certresolver=lets-encrypt
- traefik.http.services.iredmail.loadbalancer.server.port=443
- traefik.http.services.iredmail.loadbalancer.server.scheme=https
traefik.toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[api]
dashboard = true
[certificatesResolvers.lets-encrypt.acme]
email = "xxx"
storage = "acme.json"
[certificatesResolvers.lets-encrypt.acme.tlsChallenge]
[providers.docker]
watch = true
network = "web"
[providers.file]
filename = "traefik_dynamic.toml"
traefic_dynamic.toml
[http.middlewares.simpleAuth.basicAuth]
users = [
"xxx"
]
[http.routers.api]
rule = "Host(`xxx`)"
entrypoints = ["websecure"]
middlewares = ["simpleAuth"]
service = "api@internal"
[http.routers.api.tls]
certResolver = "lets-encrypt"
Guide I followed to install traefik