Skip to content
Browse files

HTTP backup port for HTTPS apps.

  • Loading branch information...
1 parent 7a01cc9 commit e2a9c862eed3b867295d937110a8709b4e889cf6 @pwnall committed Dec 17, 2012
Showing with 7 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +4 −1 lib/rails_pwnerer/app/config.rb
  3. +1 −0 lib/rails_pwnerer/app/nginx_config.rb
View
2 CHANGELOG
@@ -1,3 +1,5 @@
+v0.7.1. Allow SSL apps to listen on non-SSL port as well.
+
v0.7.0. New config layout facilitates having per-host configs in separate repository.
v0.6.109. Allow .crt for SSL certificate chains.
View
5 lib/rails_pwnerer/app/config.rb
@@ -35,8 +35,10 @@ def populate_defaults(app_name, instance_name, app_db)
app_db[:dns_name] ||= ''
# the environment to run the application in
app_db[:environment] ||= 'production'
- # a port for server-based filtering (multiple apps on the same box)
+ # main port where the application receives HTTP(S) outside connections
app_db[:port] ||= 80
+ # HTTPS applications also accept HTTP connections here, unless 0
+ app_db[:non_ssl_port] ||= 80
# the maximum request size (megabytes) to be accepted by an application
app_db[:max_request_mb] ||= 48
# comma-separated directories that should be writable by the application user
@@ -87,6 +89,7 @@ def update(app_name, instance_name)
app_config[:ssl_cert] = ssl_cert
app_config[:ssl_key] = ssl_key
app_config[:port] = 443
+ app_config[:non_ssl_port] = 80
end
["config/rails_pwnerer.yml", "config/rails_pwnerer/#{instance_name}.yml"].each do |fname|
View
1 lib/rails_pwnerer/app/nginx_config.rb
@@ -32,6 +32,7 @@ def config_nginx(app_name, instance_name)
f << <<NGINX_CONFIG
server {
listen #{app_port}#{app_config[:ssl_key] ? ' ssl' : ''};
+ #{(app_config[:ssl_key] && app_config[:non_ssl_port] != 0) ? "listen #{app_config[:non_ssl_port]}" : "" }
charset utf-8;
#{app_config[:ssl_key] ? 'ssl on;' : ''}
#{app_config[:ssl_key] ? "ssl_certificate #{app_config[:ssl_cert]};" : ''}

0 comments on commit e2a9c86

Please sign in to comment.
Something went wrong with that request. Please try again.