Last active
December 23, 2015 16:09
-
-
Save ruz/4a66ee78fedf27181799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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