0

Background: I have a small Rails application running on Pivotal Web Services with MongoDB in the background as the database layer. I have used as much of the standards offered by Rails and PWS but have changed Webrick with Unicorn as the application server to allow for better scaling/multi-processing.


My Challenge: My next challenge in my project is to introduce SSL and here is where i need some help.


What Have I Found Already: I have found information on how to use SSL with Webrick, or Thin, Puma and Nginx but nothing on SSL with Unicorn. I also have found that Webrick, Thin and Nginx are called Web Servers while Unicorn is typically called an Application Server with HTTP capabilities.


Questions:

  • Do I need to add a web server in front of Unicorn to implement SSL between my browser clients and my PWS application, or can it be done in Unicorn as well?
  • If i need to add a web server, is the PWS standard web server a good option, as i would be able to leverage the load balancing and horizontal scaling which i get standard with PWS?
  • If i implement Nginx or another web server with my application, do i then loose the standard PWS load balancing features?
  • You will need to handle SSL termination *in-front* of the PWS load balancers (and there should be a secure connection between your SSL terminators and the PWS load balancers), not *behind* the load balancers (i.e. not at your application level). This doc may be of help: https://docs.run.pivotal.io/marketplace/integrations/cloudflare/ – Amit Kumar Gupta Mar 01 '16 at 18:52
  • That turned out to be the very simple and easy answer. All it took was to uncomment the following line in config/environments/production.rb: config.force_ssl = true. That enabled SSL with the PWS load balancers as you stated. Case Closed. – user8737928 Mar 02 '16 at 20:30
  • Cool! You should write and accept your own answer, that will be helpful for the next person who has the same question. – Amit Kumar Gupta Mar 02 '16 at 20:33

1 Answers1

0

All it took was to uncomment the following line in config/environments/production.rb: config.force_ssl = true.

That enabled SSL between the client and the PWS load balancers. Gotta love rails and gotta love Pivotal Web Services.