Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
ssl and geoip always
Browse files Browse the repository at this point in the history
dwradcliffe committed Jun 20, 2014
1 parent 0d65b24 commit 365b6c2
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Berksfile.lock
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@ GRAPH
runit (>= 0.0.0)
unicorn (>= 0.0.0)
user (>= 0.0.0)
rubygems-balancer (0.0.8)
rubygems-balancer (0.0.9)
chef-vault (>= 0.0.0)
nginx (>= 0.0.0)
rubygems (>= 0.0.0)
2 changes: 1 addition & 1 deletion cookbooks/rubygems-balancer/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'rubygems-balancer'
version '0.0.8'
version '0.0.9'

depends 'chef-vault'
depends 'nginx'
9 changes: 2 additions & 7 deletions cookbooks/rubygems-balancer/templates/default/site.conf.erb
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ server {

server_name <%= @server_names.join(' ') %>;

<% if @use_ssl && @force_ssl %>
<% if @force_ssl %>
# redirect all requests to SSL
rewrite ^(.*) https://$host$1 permanent;
<% else %>
@@ -159,15 +159,13 @@ server {
rewrite ^(.*) https://rubygems.org$1 permanent;
}

<% if @use_ssl %>
# HTTPS
server {
# port to listen on. Can also be set to an IP:PORT

listen 443 default ssl;

server_name <%= @server_names.join(" ") %>;

<% if node["nginx"]["geoip"] %>
if ($geoip_country_code = "CN") {
set $gem_mirror_ssl https://au-m.rubygems.org;
}
@@ -188,8 +186,6 @@ server {
set $gem_mirror_ssl https://aws-eu-cache01.rubygems.org;
}

<% end %>

# SSL settings
ssl on;
ssl_certificate <%= @ssl_cert %>;
@@ -323,4 +319,3 @@ server {
}

}
<% end %>

0 comments on commit 365b6c2

Please sign in to comment.