Skip to content

Commit

Permalink
Fix httpd config for X-Forwarded-Proto
Browse files Browse the repository at this point in the history
  • Loading branch information
mumesan committed Jan 3, 2025
1 parent 6e7951e commit b503b6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions templates/ironicapi/config/ironic-api-httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ CustomLog /dev/stdout proxy env=forwarded
SSLEngine on
SSLCertificateFile "{{ $vhost.SSLCertificateFile }}"
SSLCertificateKeyFile "{{ $vhost.SSLCertificateKeyFile }}"
{{- else }}
SetEnvIf X-Forwarded-Proto http HTTPS=0
{{- end }}

## WSGI configuration
Expand Down
10 changes: 8 additions & 2 deletions templates/ironicinspector/config/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ CustomLog /dev/stdout proxy env=forwarded
ServerName {{ $vhost.ServerName }}

## Request header rules
## as per http://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader
RequestHeader set X-Forwarded-Proto "https"
## as per http://httpd.apache.org/docs/2.4/mod/mod_headers.html#requestheader
{{- if $vhost.TLS }}
RequestHeader setIfEmpty X-Forwarded-Proto "https"
{{- else }}
RequestHeader setIfEmpty X-Forwarded-Proto "http"
{{- end }}

## Proxy rules
ProxyRequests Off
Expand All @@ -46,6 +50,8 @@ CustomLog /dev/stdout proxy env=forwarded
SSLEngine on
SSLCertificateFile "{{ $vhost.SSLCertificateFile }}"
SSLCertificateKeyFile "{{ $vhost.SSLCertificateKeyFile }}"
{{- else }}
SetEnvIf X-Forwarded-Proto http HTTPS=0
{{- end }}
</VirtualHost>
{{ end }}

0 comments on commit b503b6f

Please sign in to comment.