7 messages in ru.sysoev.nginxRe: feature request: migrate rewrite ...
FromSent OnAttachments
Jonathan VanascoMar 10, 2007 10:18 am 
Igor SysoevMar 11, 2007 1:11 pm 
Jonathan VanascoMar 11, 2007 3:11 pm 
Boris BartsytsMar 13, 2007 8:30 am 
RoxisMar 13, 2007 8:42 am 
Boris BartsytsMar 13, 2007 9:03 am 
Gregg ReynoldsMar 16, 2007 7:56 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: feature request: migrate rewrite into Main / HTTPActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Mar 11, 2007 1:11:24 pm
List:ru.sysoev.nginx

On Sat, Mar 10, 2007 at 01:18:50PM -0500, Jonathan Vanasco wrote:

Would it be possible to migrate some of the rewrite functions out of rewrite and into other sections?

I say this because documentation wise, and compilation wise , its very awkward -- things are not really where you expect them to be

suggestion:

Migrated to Main - control functions break if return set uninitialized_variable

It's not possible for reasons descreibed below.

Migrated to HTTP return

What it should "return" at http level ?

http { return 404; }

?

Stays the same - rewrite

I can't imagine why someone would compile nginx without rewrite - other than mistake. but having the control functions and return function in rewrite makes them very much 'hidden' from the main documentation.

nginx has three type of configuration directives:

1) static: the most directives, 2) partially dynamic: the directives with $variable paramters, 3) and dynamic: if/rewrite/set/break/return.

The static directives are compiled into binary structures for each server and locations and they are usually availabe via three and so memory accesses.

The partially dynamic directives are also compiled into binary structures and besides the dynamic parts are compiled into some code that run at request processing stage.

The dynamic directives are compiled into some code that run at request processing stage. They can not be used to choose configuration parts.

Initially the rewrite module was developed under the influence of Apache's mod_rewrite (the "rewrite" direcive). Then the "if" block appeared and this block configuration is considred as some static location configuration: if you use

if (some_true_value) { configuration A }

if (some_true_value_too) { configuration B }

you get configuration B, but not A+B. To use configuration A, you should use the "break" inside first block.

I do not like the current state of rewrite module, but still did not decide how to change it internally to allow dynamic configurations. There is currently the only workaround:

# static if (...) { limit_rate 1k; }

# fully dynamic: if (...) { set $limit_rate 1k; }