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.



67
68
69
70
# File 'lib/shared_infrastructure/nginx/location.rb', line 67

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

Instance Method Details

#to_s(level = 0) ⇒ Object



72
73
74
75
76
77
78
79
80
81
# File 'lib/shared_infrastructure/nginx/location.rb', line 72

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