Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,9 @@ prefix "contents";
'name', 'Strict-Transport-Security',
'value', 'max-age=15768000'
));

"vhosts/keystone/requestheader" = append(dict(
'action', 'set',
'name', 'X-MAGIC-SOMETHING',
'value', '%{MAGIC}xyz'
));
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Base test for keystone wsgi config
^ errorlogformat "%\{cu\}t %M"
^ customlog /var/log/httpd/keystone_access.log combined
^ header add Strict-Transport-Security "max-age=15768000"
^ requestheader set X-MAGIC-SOMETHING "%\{MAGIC\}xyz"
^ <directory /usr/bin>
^ require all granted
^ </directory>
Expand Down
2 changes: 1 addition & 1 deletion ncm-metaconfig/src/main/metaconfig/httpd/config/header.tt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[%- FOREACH header IN desc %]
header [% IF header.always %]always [% END %][% header.action %] [% header.name %] [% header.quotes %][% header.value %][% header.quotes %]
[% headermode %]header [% IF header.always %]always [% END %][% header.action %] [% header.name %] [% header.quotes %][% header.value %][% header.quotes %]
[% END -%]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[% INCLUDE "metaconfig/httpd/config/header.tt" headermode='request' %]
3 changes: 2 additions & 1 deletion ncm-metaconfig/src/main/metaconfig/httpd/config/vhost.tt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ limitrequestbody [% vhost.limitrequestbody %]
protocols [% vhost.protocols.join(' ') %]
[% END -%]
[%- to_process = ['ssl', 'nss', 'env', 'aliases', 'rewrite', 'redirect',
'perl', 'wsgi', 'log', 'rails', 'browsermatch', 'passenger', 'oidc', 'header'] -%]
'perl', 'wsgi', 'log', 'rails', 'browsermatch', 'passenger',
'oidc', 'header', 'requestheader'] -%]
[%- FOREACH p IN to_process -%]
[%- IF vhost.exists(p) -%]
[% INCLUDE "metaconfig/httpd/config/${p}.tt" desc=vhost.$p %]
Expand Down
14 changes: 12 additions & 2 deletions ncm-metaconfig/src/main/metaconfig/httpd/pan/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,23 @@ type httpd_directory = {

type httpd_vhost_ip = string with is_ip(SELF) || SELF == '*';

type httpd_header = {
type httpd_header_base = {
"name" : string
"action" : choice('add', 'append', 'echo', 'edit', 'edit*', 'merge', 'set', 'setifempty', 'unset', 'note')
"value" : string
"quotes" : string = '"'
"always" ? boolean
};

type httpd_header = {
include httpd_header_base
"action" : choice('add', 'append', 'echo', 'edit', 'edit*', 'merge', 'set', 'setifempty', 'unset', 'note')
};

type httpd_requestheader = {
include httpd_header_base
"action" : choice('add', 'append', 'edit', 'edit*', 'merge', 'set', 'setifempty', 'unset')
};

type httpd_serveralias = string with match(SELF, '^[\w.*]+$'); # serveralias supports wildcards

type httpd_vhost = {
Expand All @@ -642,6 +651,7 @@ type httpd_vhost = {
"browsermatch" ? httpd_browsermatch[]
"passenger" ? httpd_passenger_vhost
"header" ? httpd_header[]
"requestheader" ? httpd_requestheader[]
"protocols" ? httpd_protocols[]
};

Expand Down
Loading