Skip to content

Instantly share code, notes, and snippets.

@ruz

ruz/nginx.conf

Last active Dec 23, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.