Skip to content

Instantly share code, notes, and snippets.

@yko

yko/App.pm Secret

Created February 16, 2011 08:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yko/911fea4ce47558d74344 to your computer and use it in GitHub Desktop.
Save yko/911fea4ce47558d74344 to your computer and use it in GitHub Desktop.
# ...
sub startup {
my $self = shift;
$self->hook(
before_dispatch => sub {
my $c = shift;
warn $c->req->to_string;
my $base = Mojo::URL->new(scalar $c->req->headers->header('X-Proxy-Path'));
$c->req->url->base( $base );
}
);
}
# ...
# ...
http {
# ...
upstream test {
server 127.0.0.1:3000;
}
server {
listen *:80;
location /test {
proxy_pass http://test/$request_uri;
proxy_set_header X-Proxy-Path "/test";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
}
# ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment