SSL auto-renewal failing on redirected domains
Hi all,
My company has a Forge server only used for domain redirections. In Forge interface, it means that sites on this server don’t host any app, but are only filled with one redirect ( / to https://otherdomain.tld).
When comes the time for Let’s Encrypt auto-renewal (to renew the redirected domain certificate), the process fails as Let’s Encrypt bot is trying to query a URL ( .well-known/blabla ) that ends up being redirected like the whole domain.
So… I don’t know if it’s a feature not supported by Forge or if the problem lies somewhere else.
I think the following Nginx settings are loaded (not sure of the order, however):
In before/ssl_redirect.conf:
# Redirect every request to HTTPS...
server {
listen 80;
listen [::]:80;
server_name .MYDNS.TLD.be;
return 301 https://$host$request_uri;
}
In mytld.conf
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/MYDNS.TLD./before/*;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name MYDNS.TLD.;
root /home/forge/MYDNS.TLD./;
# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/MYDNS.TLD./540731/server.crt;
ssl_certificate_key /etc/nginx/ssl/MYDNS.TLD./540731/server.key;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/MYDNS.TLD./server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/MYDNS.TLD.-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/MYDNS.TLD./after/*;
In server/redirect_rules.conf:
# Laravel Forge Redirect Rule 26978
rewrite / https://MYTARGETDNS.TLD redirect;
In server/letsencrypt_challenge.com:
location /.well-known/acme-challenge {
auth_basic off;
allow all;
alias /home/forge/.letsencrypt;
}
Also, my Nginx abilities are limited (front-end developer, here).
Please or to participate in this conversation.