Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

137 lines (102 sloc) 2.428 kB
worker_processes 1;
debug_points abort;
pid /tmp/nginx-js.pid;
error_log logs/error.log debug_http;
events { worker_connections 1024; }
http
{
include /usr/local/nginx/conf/mime.types;
default_type text/html;
js_maxmem 4M;
# js_utf8; # do not know why but it's broken
js_load 'js/nginx.js';
js_load "js/demos/handler.js";
js_require 'Handler.js';
# js_set Nginx.someVar 123;
# js_filter 'Handler.processFilter';
# js_filter_types text/html text/css application/x-javascript;
js_set $js_set_string "function () { return 'bar1' }";
js_set $js_set_null "function () { return null }";
js_set $js_set_undefined "function () { return undefined }";
js_set $js_set_number "function () { return 123 }";
js_set $js_set_property "function (r) { r.rootMe(); return r.property = 'property' }";
js_set $msie6 '
function (r)
{
var ua = r.headersIn["User-Agent"]
if (/Opera/.test(ua))
return ""
if (/ MSIE [6-9]\.\d+/.test(ua))
return "1"
return "";
}
';
access_log off;
sendfile on;
keepalive_timeout 65;
server
{
listen 127.0.0.1:19090;
server_name _;
root html;
index index.html;
set $js_request_variables_a "abc";
set $js_request_variables_b "${js_request_variables_a}123";
set $js_request_variables_j "xx${js_set_string}xx";
set $js_request_variables_v "";
location / {}
location /demo/
{
js 'Handler.demo';
}
location = /demo/random
{
js 'function (r) { r.sendString(Math.random()); return Nginx.OK }';
}
location = /demo/msie6
{
if ($msie6)
{
return 404;
}
rewrite ^ /;
}
location = /demo/handler
{
js Hello.handler;
}
location /run/
{
js 'Handler.run';
}
location /run/request-body-file
{
client_body_in_file_only on;
js 'Handler.run';
}
location = /variable-set
{
rewrite ^ /run/variable-set?string=$js_set_string&null=$js_set_null&undefined=$js_set_undefined&number=$js_set_number&property=$js_set_property? last;
}
location /quick
{
return 403;
}
location /loopback
{
proxy_pass http://127.0.0.1:19090/;
proxy_set_header Host "localhost";
# proxy_pass_header X-La-la-la;
}
location /rewrite/
{
rewrite "^/rewrite/(.*)$" /$1;
}
location /nginx.org
{
proxy_pass http://nginx.org/;
proxy_buffers 3 512K;
proxy_buffer_size 512K;
}
}
}
Jump to Line
Something went wrong with that request. Please try again.