Skip to content

Commit 1570fc2

Browse files
Merge pull request #508 from mumesan/fix_httpd_requestheader
Fix httpd config for X-Forwarded-Proto Jira: <OSPRH-12377>
2 parents 6e7951e + 6b9721e commit 1570fc2

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

templates/ironicapi/config/ironic-api-httpd.conf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ CustomLog /dev/stdout proxy env=forwarded
3939
Require all granted
4040
</Directory>
4141

42-
{{- if $vhost.TLS }}
42+
{{- if $vhost.TLS }}
4343
SetEnvIf X-Forwarded-Proto https HTTPS=1
4444

4545
## SSL directives
4646
SSLEngine on
4747
SSLCertificateFile "{{ $vhost.SSLCertificateFile }}"
4848
SSLCertificateKeyFile "{{ $vhost.SSLCertificateKeyFile }}"
49-
{{- end }}
49+
{{- else }}
50+
SetEnvIf X-Forwarded-Proto http HTTPS=0
51+
{{- end }}
5052

5153
## WSGI configuration
5254
WSGIApplicationGroup %{GLOBAL}

templates/ironicinspector/config/httpd.conf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,28 @@ CustomLog /dev/stdout proxy env=forwarded
3030
ServerName {{ $vhost.ServerName }}
3131

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

3640
## Proxy rules
3741
ProxyRequests Off
3842
ProxyPreserveHost Off
3943
ProxyPass / http://localhost:5051/ retry=10
4044
ProxyPassReverse / http://localhost:5051/
4145

42-
{{- if $vhost.TLS }}
46+
{{- if $vhost.TLS }}
4347
SetEnvIf X-Forwarded-Proto https HTTPS=1
4448

4549
## SSL directives
4650
SSLEngine on
4751
SSLCertificateFile "{{ $vhost.SSLCertificateFile }}"
4852
SSLCertificateKeyFile "{{ $vhost.SSLCertificateKeyFile }}"
49-
{{- end }}
53+
{{- else }}
54+
SetEnvIf X-Forwarded-Proto http HTTPS=0
55+
{{- end }}
5056
</VirtualHost>
5157
{{ end }}

0 commit comments

Comments
 (0)