Skip to content

Commit bdabb6b

Browse files
committed
feat(nginx-proxy): Add SSL_STAPLING env var to control OCSP stapling
Add SSL_STAPLING environment variable (default: on) to allow disabling OCSP stapling for certificates without OCSP responder URLs. Usage: Set SSL_STAPLING=off on containers to silence the warning: 'ssl_stapling ignored, no OCSP responder URL in the certificate' This is useful for self-signed certificates or certificates from CAs that don't provide OCSP responder URLs.
1 parent 409962c commit bdabb6b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

nginx-proxy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ deny all;
139139
| `VIRTUAL_PROTO` | Protocol (`http`, `https`, `uwsgi`, `fastcgi`) | `http` |
140140
| `HTTPS_METHOD` | `redirect`, `noredirect`, `nohttps` | `redirect` |
141141
| `SSL_POLICY` | SSL/TLS policy | `Mozilla-Modern` |
142+
| `SSL_STAPLING` | Enable OCSP stapling (`on` or `off`) | `on` |
142143
| `HSTS` | HSTS header value | `max-age=31536000` |
143144
| `CERT_NAME` | Custom certificate name | auto-detected |
144145
| `NETWORK_ACCESS` | `external` or `internal` | `external` |

nginx-proxy/nginx.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ server {
358358
{{/* Get the HSTS defined by containers w/ the same vhost, falling back to "max-age=31536000" */}}
359359
{{ $hsts := or (first (groupByKeys $containers "Env.HSTS")) "max-age=31536000" }}
360360

361+
{{/* Get the SSL_STAPLING defined by containers w/ the same vhost, falling back to "on" */}}
362+
{{ $ssl_stapling := or (first (groupByKeys $containers "Env.SSL_STAPLING")) "on" }}
363+
361364
{{/* Get the VIRTUAL_ROOT By containers w/ use fastcgi root */}}
362365
{{ $vhost_root := or (first (groupByKeys $containers "Env.VIRTUAL_ROOT")) "/var/www/public" }}
363366

@@ -445,7 +448,7 @@ server {
445448
ssl_dhparam {{ printf "/etc/nginx/certs/%s.dhparam.pem" $cert }};
446449
{{ end }}
447450

448-
{{ if (exists (printf "/etc/nginx/certs/%s.chain.pem" $cert)) }}
451+
{{ if (and (eq $ssl_stapling "on") (exists (printf "/etc/nginx/certs/%s.chain.pem" $cert))) }}
449452
ssl_stapling on;
450453
ssl_stapling_verify on;
451454
ssl_trusted_certificate {{ printf "/etc/nginx/certs/%s.chain.pem" $cert }};

0 commit comments

Comments
 (0)