Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions manifests/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
$content_base_url = "unix://${pulpcore::content_socket_path}|http://pulpcore-content"
$content_url = "${content_base_url}${content_path}"

$forwarded_proto_header = ['set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}']

$docroot_directory = {
'provider' => 'Directory',
'path' => $pulpcore::apache_docroot,
Expand All @@ -38,7 +40,7 @@
'request_headers' => [
'unset X-CLIENT-CERT',
'set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT',
],
] + $forwarded_proto_header,
}

# Pulp has a default for remote header. Here it's ensured that the end user
Expand All @@ -65,7 +67,7 @@
'params' => $api_proxy_params,
},
],
'request_headers' => $api_default_request_headers + $api_additional_request_headers,
'request_headers' => $api_default_request_headers + $api_additional_request_headers + $forwarded_proto_header,
}

# Static content is served by the whitenoise application. SELinux prevents
Expand Down
8 changes: 8 additions & 0 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
'request_headers' => [
'unset X-CLIENT-CERT',
'set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT',
'set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}',
],
},
])
Expand All @@ -121,6 +122,7 @@
'request_headers' => [
'unset X-CLIENT-CERT',
'set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT',
'set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}',
],
},
{
Expand All @@ -133,6 +135,7 @@
'request_headers' => [
'unset REMOTE-USER',
'unset REMOTE_USER',
'set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}',
],
}
])
Expand Down Expand Up @@ -334,6 +337,7 @@
<Location "/pulp/content">
RequestHeader unset X-CLIENT-CERT
RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT
RequestHeader set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}
ProxyPass unix:///run/pulpcore-content.sock|http://pulpcore-content/pulp/content disablereuse=on timeout=600
ProxyPassReverse unix:///run/pulpcore-content.sock|http://pulpcore-content/pulp/content
</Location>
Expand All @@ -351,13 +355,15 @@
<Location "/pulp/content">
RequestHeader unset X-CLIENT-CERT
RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT
RequestHeader set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}
ProxyPass unix:///run/pulpcore-content.sock|http://pulpcore-content/pulp/content disablereuse=on timeout=600
ProxyPassReverse unix:///run/pulpcore-content.sock|http://pulpcore-content/pulp/content
</Location>
<Location "/pulp/api/v3">
RequestHeader unset REMOTE-USER
RequestHeader unset REMOTE_USER
RequestHeader set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the lines above, do we need to unset the underscore variations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of forwarded proto? modern gunicorn will reject it anyway, so I'd skip it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too, but it looked inconsistent with the above.

ProxyPass unix:///run/pulpcore-api.sock|http://pulpcore-api/pulp/api/v3 timeout=600
ProxyPassReverse unix:///run/pulpcore-api.sock|http://pulpcore-api/pulp/api/v3
</Location>
Expand Down Expand Up @@ -510,6 +516,7 @@
'request_headers' => [
'unset X-CLIENT-CERT',
'set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT',
'set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}',
],
},
{
Expand All @@ -523,6 +530,7 @@
'unset REMOTE-USER',
'unset REMOTE_USER',
'set REMOTE-USER "admin" "expr=%{tolower:%{SSL_CLIENT_S_DN_CN}} == \'foreman.example.com\'"',
'set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME}',
],
}
])
Expand Down
Loading