Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to add a header to the HTTP response #208

Merged
merged 2 commits into from
Dec 24, 2013

Conversation

hdanes
Copy link
Contributor

@hdanes hdanes commented Dec 24, 2013

when response code is equal to 200, 204, 301, 302 or 304.

For Example:

nginx::resource::vhost { 'example.com':
add_header => {
'Strict-Transport-Security' => 'max-age=15768000',
},
}

…e code is equal to 200, 204, 301, 302 or 304.
@@ -26,6 +26,9 @@ server {
<% @proxy_set_header.each do |header| -%>
proxy_set_header <%= header %>;
<% end -%>
<% if @add_header -%><% @add_header.each do |key,value| -%>
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat! You should cast @add_header as an Array in the event a user only wants to provide one header to be added. See https://github.com/jfryman/puppet-nginx/blob/master/templates/vhost/vhost_location_directory.erb#L21 for an example of this.

@hdanes
Copy link
Contributor Author

hdanes commented Dec 24, 2013

Thankx for you're fast feedback!

The add_header directive should be a key, value pair in Nginx (Syntax: add_header name value). I've used the hash data type in Puppet to make sure there is always a key > value pair used. To prevent invalid input I've implement some validation in my 2nd commit. Please could you verify my request?

@jfryman
Copy link
Contributor

jfryman commented Dec 24, 2013

@hdanes love it! The validation makes much more sense here. Thanks for the code!

jfryman pushed a commit that referenced this pull request Dec 24, 2013
Add the possibility to add a header to the HTTP response
@jfryman jfryman merged commit 7d1540b into voxpupuli:master Dec 24, 2013
@hdanes hdanes deleted the add_header branch December 24, 2013 18:52
cegeka-jenkins pushed a commit to cegeka/puppet-nginx that referenced this pull request Oct 23, 2017
Add the possibility to add a header to the HTTP response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants