# Required nginx configuration
server {
  listen  80;
  server_name <%= @domains.split(',').map{|x| "*.#{x.strip}"}.join(" ") %>;
  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect off;
    proxy_pass http://localhost:<%= @http_port%>; # The real pow port
  }
}

# Required nginx configuration
server {
  listen  80;
  server_name <%= @domains.split(',').map{|x| "*.#{x.strip}"}.join(" ") %>;
  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_redirect off;
    proxy_pass http://localhost:<%= @http_port%>; # The real pow port
  }
}

Set X-Forwarded-Port header to fix rack middleware
Set X-Forwarded-Port header to fix rack middleware

Rack middleware currently generates incorrect URLs when serving an app
through pow with this module. During a request to `http://myapp.pow`,
calling `Rack::Request#url` produces `http://myapp.pow:30559`.

Rack is incorrectly using the port that pow is listening for proxied
connections on. This header tells rack what the original port that the
end user connected to was, which lets it generate the right URLs.
