Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Commit

Permalink
Merge pull request #175 from intercity/redirect-domains
Browse files Browse the repository at this point in the history
Allow redirect domains for passenger stack as well
  • Loading branch information
jvanbaarsen committed Feb 21, 2015
2 parents e7e293b + 9e04674 commit 17406e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This project makes use of the [Sementic Versioning](http://semver.org/)
- Nothing

### Fixed
- Nothing
- Allow redirect domains to be set for the Passenger stack as well

### Misc
- Downgraded to ruby 2.1.5
Expand Down
1 change: 1 addition & 0 deletions vendor/cookbooks/rails/recipes/passenger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
name: app,
rails_env: rails_env,
domain_names: app_info["domain_names"],
redirect_domain_names: app_info["redirect_domain_names"],
enable_ssl: File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt"),
custom_configuration: nginx_custom_configuration(app_info))
notifies :reload, resources(:service => "nginx")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<%= @custom_configuration["before_server"] %>

<% if @redirect_domain_names && @redirect_domain_names.any? %>
server {
listen <%= node['nginx']['port'] || '80' %>;
<% if @enable_ssl %>
listen 443 ssl;
<% end %>
server_name <%= @redirect_domain_names.join(' ') %>;
return 301 $scheme://<%= @domain_names.first %>$request_uri;
}
<% end %>

server {
listen <%= node['nginx']['port'] || '80' %>;
server_name <%= @domain_names.join(' ') %>;
Expand Down

0 comments on commit 17406e5

Please sign in to comment.