Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Guard SSL config using USE_SSL config var

  • Loading branch information...
commit 59da508df2b8e5f44aacd9db9e83d5c646f97174 1 parent 0197744
@peterkeen authored
Showing with 8 additions and 0 deletions.
  1. +4 −0 data/templates/nginx.erb
  2. +4 −0 lib/dokuen/application.rb
View
4 data/templates/nginx.erb
@@ -7,16 +7,20 @@ upstream <%= name %> {
server {
listen 80;
+ <% if use_ssl %>
listen 443 ssl;
+ <% end %>
server_name <%= name %>.<%= config.base_domain_name %>;
<% additional_domains.each do |domain| %>
server_name <%= domain %>;
<% end %>
+ <% if use_ssl %>
if ($ssl_protocol = "") {
rewrite ^ https://$server_name$request_uri? permanent;
}
+ <% end %>
location / {
proxy_pass http://<%= name %>;
View
4 lib/dokuen/application.rb
@@ -309,4 +309,8 @@ def additional_domains
(env['ADDITIONAL_DOMAINS'] || '').split(',')
end
+ def use_ssl
+ env['USE_SSL']
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.