Class: Nginx::RailsLocation
- Inherits:
-
Object
- Object
- Nginx::RailsLocation
- Defined in:
- lib/shared_infrastructure/nginx/location.rb
Instance Method Summary collapse
-
#initialize(domain_name) ⇒ RailsLocation
constructor
A new instance of RailsLocation.
- #to_s(level = 0) ⇒ Object
Constructor Details
#initialize(domain_name) ⇒ RailsLocation
Returns a new instance of RailsLocation.
56 57 58 |
# File 'lib/shared_infrastructure/nginx/location.rb', line 56 def initialize(domain_name) @domain_name = domain_name end |
Instance Method Details
#to_s(level = 0) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/shared_infrastructure/nginx/location.rb', line 60 def to_s(level = 0) Lines.new("location @#{domain_name} {", " # A Rails app should force \"SSL\" so that it generates redirects to HTTPS,", " # among other things.", " # However, you want Nginx to handle the workload of TLS.", " # The trick to proxying to a Rails app, therefore, is to proxy pass to HTTP,", " # but set the header to HTTPS", " # Next two lines.", " proxy_pass http://#{domain_name};", " proxy_set_header X-Forwarded-Proto $scheme; # $scheme says http or https", " proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;", " proxy_set_header Host $http_host;", " proxy_redirect off;", "}").format(level) end |