Smartcard nginx configuration invalid when nginx redirect_http_to_https configured
Summary
If enabling Smartcard and setting nginx['redirect_http_to_https'] = true, the resulting Smartcard nginx configuration is invalid and causes nginx to not start in v18.5.x.
root@gitlab-18:/# gitlab-ctl status | grep nginx
down: nginx: 0s, normally up, want up; run: log: (pid 674) 360s
root@gitlab-18:/# tail -f /var/log/gitlab/nginx/error.log
2026/01/06 03:54:48 [emerg] 1638#0: a duplicate default server for 0.0.0.0:80 in /var/opt/gitlab/nginx/conf/service_conf/gitlab-smartcard.conf:35The changes in the Smartcard nginx config pre and post upgrade from 18.4.x to 18.5.x:
$ diff pre.conf post.conf
35c35
< listen *:80;
---
> listen *:80 default_server;
60c60
< include /var/opt/gitlab/nginx/conf/gitlab-health.conf;
---
> include /var/opt/gitlab/nginx/conf/service_conf/gitlab-health.partial;
67c67
< listen *:3444 ssl;
---
> listen *:3444 default_server ssl;
170c170
< include /var/opt/gitlab/nginx/conf/gitlab-health.conf;
---
> include /var/opt/gitlab/nginx/conf/service_conf/gitlab-health.partial;The default_server being duplicated in the file for each server block seems to cause a problem.
Workaround
Set nginx['default_server_enabled'] = false
$ diff post.conf post-no-default.conf
35c35
< listen *:80 default_server;
---
> listen *:80;
67c67
< listen *:3444 default_server ssl;
---
> listen *:3444 ssl;Steps to reproduce
- Have a working v18.4.x GitLab Omnibus node
- Configure Smartcard and set
nginx['redirect_http_to_https'] = true - Upgrade to v18.5.x
- Check nginx is running and check nginx error log
What is the current bug behavior?
Nginx stops running, the error log shows: a duplicate default server for 0.0.0.0:80 in /var/opt/gitlab/nginx/conf/service_conf/gitlab-smartcard.conf:35
What is the expected correct behavior?
The resulting nginx configuration should be valid