Skip to content

Commit a34814a

Browse files
nextlevelshitMichael Czechowski
authored andcommitted
feat(nginx): 301 www.codecrispi.es → codecrispi.es (#188)
Co-authored-by: Michael Czechowski <mail@dailysh.it> Co-committed-by: Michael Czechowski <mail@dailysh.it>
1 parent 6cfe536 commit a34814a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

nginx.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ http {
6161
access_log /dev/stdout main;
6262
error_log /dev/stderr warn;
6363

64+
# Canonical-host redirect: www.codecrispi.es → codecrispi.es (apex).
65+
# Upstream proxy terminates TLS; we only see plain HTTP here, but the
66+
# Host header survives so we can detect www and 301 it.
67+
# Header sent uses https:// because the original request was HTTPS at
68+
# the proxy boundary. If an upstream sets X-Forwarded-Proto, we honor
69+
# that; otherwise default to https (production reality).
70+
server {
71+
listen 80;
72+
listen [::]:80;
73+
server_name www.codecrispi.es;
74+
return 301 https://codecrispi.es$request_uri;
75+
}
76+
6477
server {
6578
listen 80 default_server;
6679
listen [::]:80 default_server;

0 commit comments

Comments
 (0)