Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated README to introduce ngx_lua as a better alternative to ngx_eval.

  • Loading branch information...
commit fcdae418c683f160b59cc1b4534cc38e4f1a6a12 1 parent dca2cdd
@agentzh agentzh authored
Showing with 32 additions and 7 deletions.
  1. +25 −3 README
  2. +2 −0  config
  3. +4 −3 test/t/sanity.t
  4. +1 −1  util/build.sh
View
28 README
@@ -43,9 +43,9 @@ Synopsis
Description
-This fork of ngx_eval can work with any content handlers and even with filters enabled
-as long as you put ngx_eval *before* your filter modules during nginx configure, for
-instance
+ This fork of ngx_eval can work with any content handlers and
+ even with filters enabled as long as you put ngx_eval *before*
+ your filter modules during nginx configure, for instance
./configure --prefix=/opt/nginx \
--add-module=/path/to/this/nginx-eval-module \
@@ -54,6 +54,10 @@ instance
such that ngx_eval's filter works *after* your filter modules.
+Limitations
+ * The contents of subrequests issued from the eval block won't be
+ captured properly.
+
Compatibility
The following versions of Nginx should work with this module:
@@ -70,6 +74,24 @@ but fortunately a patch is available for nginx 0.8.53:
This one-line patch should also be able to apply cleanly to other versions
of nginx 0.8.42+.
+Nowadays we prefer ngx_lua to do the tasks originally done by ngx_eval
+because various limitations in ngx_lua (and yeah, it requires patching
+the core for nginx 0.8.42+, sigh).
+
+Here's a small example using ngx_lua:
+
+ location / {
+ content_by_lua '
+ local res = ngx.location.capture('/getbanner')
+ ngx.print(res)
+ ';
+ }
+
+ location /getbanner {
+ internal;
+ proxy_pass http://backend.local:3500;
+ }
+
Original ngx_eval documentation:
Documentation for this module could be found under following URLs:
View
2  config
@@ -2,3 +2,5 @@ ngx_addon_name=ngx_http_eval_module
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_eval_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_eval_module.c"
CFLAGS="$CFLAGS -DNDK_SET_VAR"
+#have=NDK_REWRITE_PHASE . auto/have
+
View
7 test/t/sanity.t
@@ -201,11 +201,13 @@ a=[], b=[2], c=[a b c]
=== TEST 10: sanity check
--- config
location /echo {
- #eval_subrequest_in_memory off;
+ eval_subrequest_in_memory off;
+ #eval_subrequest_in_memory on;
#eval_buffer_size 3;
eval $a {
#echo_before_body BEFORE;
- proxy_pass $scheme://127.0.0.1:1234/hi;
+ proxy_pass $scheme://127.0.0.1:$server_port/hi;
+ #proxy_pass $scheme://127.0.0.1:1234/hi;
}
echo '!!! [$a]';
}
@@ -217,5 +219,4 @@ GET /echo
--- response_body
!!! [helloooooooooooooooooooo]
--- timeout: 10
---- SKIP
View
2  util/build.sh
@@ -37,9 +37,9 @@ if [[ "$BUILD_CLEAN" -eq 1 || ! -f Makefile || "$root/config" -nt Makefile || "$
--add-module=$root $opts \
--add-module=$root/../echo-nginx-module \
--add-module=$root/../memc-nginx-module \
- --add-module=$root/../ndk-nginx-module \
--with-debug
#--add-module=$root/../vallery/eval-nginx-module \
+ #--add-module=$root/../ndk-nginx-module \
#--add-module=$home/work/nginx/nginx_upstream_hash-0.3 \
#--without-http_ssi_module # we cannot disable ssi because echo_location_async depends on it (i dunno why?!)
Please sign in to comment.
Something went wrong with that request. Please try again.