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

Feature: Added HSTS header support into ssl vhost. #193

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 5 additions & 2 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
# password with HTTP Basic Authentication.
# [*auth_basic_user_file*] - This directive sets the htpasswd filename for
# the authentication realm.
# [*header_hsts*] - Adds the Strict-Transport-Security header with
# a value as defiend within.
# [*vhost_cfg_append*] - It expects a hash with custom directives to
# put after everything else inside vhost
# [*vhost_cfg_prepend*] - It expects a hash with custom directives to
Expand All @@ -77,7 +79,7 @@
# options like log format to the end.
# [*error_log*] - Where to write error log. May add additional
# options like error level to the end.
# [*passenger_cgi_param*] - Allows one to define additional CGI environment
# [*passenger_cgi_param*] - Allows one to define additional CGI environment
# variables to pass to the backend application
# Actions:
#
Expand Down Expand Up @@ -134,6 +136,7 @@
$try_files = undef,
$auth_basic = undef,
$auth_basic_user_file = undef,
$header_hsts = undef,
$vhost_cfg_prepend = undef,
$vhost_cfg_append = undef,
$include_files = undef,
Expand Down Expand Up @@ -205,7 +208,7 @@
if ($ssl == true) and ($ssl_port == $listen_port) {
$ssl_only = true
}

if $use_default_location == true {
# Create the default location reference for the vHost
nginx::resource::location {"${name}-default":
Expand Down
3 changes: 3 additions & 0 deletions templates/vhost/vhost_ssl_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ server {
<% if defined? @auth_basic_user_file -%>
auth_basic_user_file "<%= @auth_basic_user_file %>";
<% end -%>
<% if defined? @header_hsts -%>
add_header Strict-Transport-Security "<%= @header_hsts %>";
<% end -%>

access_log <%= @ssl_access_log %>;
error_log <%= @ssl_error_log %>;
Expand Down