Class: Nginx::ReverseProxyLocation

Inherits:
Location
  • Object
show all
Defined in:
lib/shared_infrastructure/nginx/location.rb

Instance Method Summary collapse

Constructor Details

#initialize(proxy_url, location = "/") ⇒ ReverseProxyLocation

Returns a new instance of ReverseProxyLocation.



82
83
84
85
# File 'lib/shared_infrastructure/nginx/location.rb', line 82

def initialize(proxy_url, location = "/")
  super location
  @proxy_url = proxy_url
end

Instance Method Details

#to_s(level = 0) ⇒ Object



87
88
89
90
91
92
93
94
95
96
# File 'lib/shared_infrastructure/nginx/location.rb', line 87

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