Welcome! Log In Create A New Profile

Advanced

Re: [feature] Add skip_location directive to ngx_http_rewrite

Dmitrii Chekaliuk
January 17, 2013 10:34AM
Hmm, you pushed me to rethink this. Actually, the logic needed for my
particular task could be done with IFs and BREAKs like this:

location / {
if ($uri ~ ^/some/path) {
if ($request_method ~ ^GET|HEAD$) {
break;
# config 1
}

if ($request_method = "PUT") {
break;
# config 2
}
}

if ($uri ~ ^/some/path/subpath$) {
# config 3
}
}

But nested IFs need to be allowed for that purpose. I can't see any
obstacles for this, as It seems like adding NGX_HTTP_SIF_CONF and
NGX_HTTP_LIF_CONF to IF's type would be enough, though I'm not very
familiar with nginx codebase to know for sure. Or there was some
objective reason to disallow nesting?

--
Yours faithfully,
Dmitrii

On 17.01.2013 13:32, Nick Kew wrote:
> On 17 Jan 2013, at 10:07, Dmitrii Chekaliuk wrote:
>
>> Hi guys,
>>
>> I'm new to nginx-devel, so, please, take my apologies in case this question was already discussed and rejected. Nginx is awesome, but I think it lacks the flexibility of configuration selection, e.g. it can't throw away the selected config on demand within the rewrite phase to select another one without a need to actually rewrite URI. Think of Apache mod_rewrite's RewriteCond+RewriteRule, it would be great to have the ability to write something like this:
> I'm not sufficiently familiar with nginx config to comment on how it might work.
>
> But with Apache we implemented <if "expr …"> to do (among other things)
> exactly what you're asking for, in a saner manner than pseudo-programming
> with mod_rewrite. Your suggestion looks like "IF foo GOTO bar", but wouldn't
> you prefer IF/ELSE/ENDIF with a similar structure to a Location block?
>

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[feature] Add skip_location directive to ngx_http_rewrite

Dmitrii Chekaliuk 999 January 17, 2013 05:08AM

Re: [feature] Add skip_location directive to ngx_http_rewrite

Nick Kew 507 January 17, 2013 06:34AM

Re: [feature] Add skip_location directive to ngx_http_rewrite

Dmitrii Chekaliuk 495 January 17, 2013 10:34AM

Re: [feature] Add skip_location directive to ngx_http_rewrite

Brian Akins 486 January 17, 2013 06:20PM

Re: [feature] Add skip_location directive to ngx_http_rewrite

Maxim Dounin 573 January 20, 2013 09:22PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 325
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready