Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

140 lines (105 sloc) 2.395 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 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_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) { 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 /run/access-path
{
js_access 'NginxTests.accessCheck';
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.