class Nginx::ReverseProxyLocation

Attributes

proxy_url[R]

Public Class Methods

new(proxy_url, location = "/") click to toggle source
Calls superclass method Nginx::Location::new
# File lib/shared_infrastructure/nginx/location.rb, line 100
def initialize(proxy_url, location = "/")
  super location
  @proxy_url = proxy_url
end

Public Instance Methods

to_s(level = 0) click to toggle source

Don't change any of the response headers nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect The URI is added if none is specified in the proxy_url.

# File lib/shared_infrastructure/nginx/location.rb, line 109
def to_s(level = 0)
  Lines.new("location #{location} {",
    "  proxy_pass #{proxy_url};",
    "  proxy_set_header Host $http_host;",
    "  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;",
    "  proxy_set_header X-Forwarded-Proto $scheme;",
    "  proxy_set_header X-Real-IP $remote_addr;",
    "  proxy_redirect off;",
    "}").format(level)
end