Skip to content

Instantly share code, notes, and snippets.

@ruz
Last active December 23, 2015 16:09
Show Gist options
  • Save ruz/4a66ee78fedf27181799 to your computer and use it in GitHub Desktop.
Save ruz/4a66ee78fedf27181799 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name example.com;
proxy_cache one;
proxy_cache_lock on;
proxy_cache_valid 1m;
location /a/ {
proxy_pass http://127.0.0.1:5000;
}
location /b/ {
proxy_pass http://127.0.0.1:5000;
}
}
use v5.14;
use strict;
use warnings;
use Time::HiRes qw(time);
return sub {
my $env = shift;
if ( $env->{REQUEST_URI} =~ /b/ ) {
use Data::Dumper;
print STDERR Dumper($env);
say readline $env->{'psgi.input'};
return [200, ['content-type' => 'text/plain'], ['hello '. time]];
} else {
return [200, ['content-type' => 'text/plain', 'X-Accel-Redirect' => '/b/'], ['']];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment