You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ਜਤਿੰਦਰ ਸਿੰਘ <ja...@gmail.com> on 2015/05/06 05:55:04 UTC

[users@httpd] Negate Regex with LocationMatch help Needed

Hello Team,

I am trying to match below conditions.

1) host:port/one --> matches 1st location directive only.
2) host:port/two --> matches 2nd location directive only.
3) All Other than host:port/one OR host:port/two --> matches 3rd location
directive (including root host:port/).

<Location /one>
        WLSRequest On
        WebLogicHost xxxx
        WebLogicPort yyyy
</Location>

<Location /two>
        WLSRequest On
        WebLogicHost xxxx
        WebLogicPort yyyy
</Location>

<LocationMatch "^/(?!one|two)">
        WLSRequest On
        WebLogicHost xxxx
        WebLogicPort yyyy
</LocationMatch>

when i try like host:port/aaa - it gives 404 as it doesnt matches any
context, however i expect it to match last one.
I have tried lot of combinations so far but doesn't seem to find it working
yet. Any suggestions Masters.

Apache/2.4.12 (Unix)
SunOS  5.10 Generic_150400-14 sun4u sparc SUNW,Netra-T12
-- 
Regards || Jatinder Singh

Re: [users@httpd] Negate Regex with LocationMatch help Needed

Posted by ਜਤਿੰਦਰ ਸਿੰਘ <ja...@gmail.com>.
I tried it - here are the observations -

the root redirect like host:port/ still doesnt gets to location third and
is served by apache.

and since this is external redirect - host:port/abc becomes host:port/three
- Seems need pathtrim etc but this redirect doesnt seems to be fit as it is
not transparent to user.

On Wed, May 6, 2015 at 9:49 AM, Daniel <df...@gmail.com> wrote:

> My fault,  the last is a <Location /three> instead of LocationMatch
>
> 2015-05-06 16:48 GMT+02:00 Daniel <df...@gmail.com>:
>
>> This is what I said:
>>
>> RedirectMatch ^/(?!one|two).* /three
>> <Location /one>
>>         WLSRequest On
>>         WebLogicHost xxxx
>>         WebLogicPort yyyy
>> </Location>
>>
>> <Location /two>
>>         WLSRequest On
>>         WebLogicHost xxxx
>>         WebLogicPort yyyy
>> </Location>
>>
>> <LocationMatch /three>
>>         WLSRequest On
>>         WebLogicHost xxxx
>>         WebLogicPort yyyy
>> </LocationMatch>
>>
>> 2015-05-06 16:41 GMT+02:00 ਜਤਿੰਦਰ ਸਿੰਘ <ja...@gmail.com>:
>>
>>> I am still figuring out the workaround option as suggested with
>>> redirectmatch, but i tried the greedy one like below without success.
>>>
>>> #<LocationMatch "^/(?!one)">
>>> #<LocationMatch "^/(?!one)[^.]*">
>>> <LocationMatch "^/(?!one).*">
>>>
>>> Tried with only "one" for testing.
>>>
>>> On Wed, May 6, 2015 at 2:35 AM, Daniel <df...@gmail.com> wrote:
>>>
>>>> Just as workaround have you tried to define the third Location as
>>>> "three" and make a redirectmatch to it with the negative lookahead instead?
>>>> If you still want to push for that locationmatch maybe you would need to
>>>> specify a ".*" at the end.
>>>>
>>>> It is probably a better solution in the long run to just make a
>>>> separate specific third location and redirect to it, at least i dont like
>>>> to use too greedy ones.
>>>> El 6/5/2015 6:02, "ਜਤਿੰਦਰ ਸਿੰਘ" <ja...@gmail.com> escribió:
>>>>
>>>>>
>>>>> Hello Team,
>>>>>
>>>>> I am trying to match below conditions.
>>>>>
>>>>> 1) host:port/one --> matches 1st location directive only.
>>>>> 2) host:port/two --> matches 2nd location directive only.
>>>>> 3) All Other than host:port/one OR host:port/two --> matches 3rd
>>>>> location directive (including root host:port/).
>>>>>
>>>>> <Location /one>
>>>>>         WLSRequest On
>>>>>         WebLogicHost xxxx
>>>>>         WebLogicPort yyyy
>>>>> </Location>
>>>>>
>>>>> <Location /two>
>>>>>         WLSRequest On
>>>>>         WebLogicHost xxxx
>>>>>         WebLogicPort yyyy
>>>>> </Location>
>>>>>
>>>>> <LocationMatch "^/(?!one|two)">
>>>>>         WLSRequest On
>>>>>         WebLogicHost xxxx
>>>>>         WebLogicPort yyyy
>>>>> </LocationMatch>
>>>>>
>>>>> when i try like host:port/aaa - it gives 404 as it doesnt matches any
>>>>> context, however i expect it to match last one.
>>>>> I have tried lot of combinations so far but doesn't seem to find it
>>>>> working yet. Any suggestions Masters.
>>>>>
>>>>> Apache/2.4.12 (Unix)
>>>>> SunOS  5.10 Generic_150400-14 sun4u sparc SUNW,Netra-T12
>>>>> --
>>>>> Regards || Jatinder Singh
>>>>>
>>>>
>>>
>>>
>>> --
>>> KRegards || Jatinder Singh
>>>
>>
>>
>>
>> --
>> *Daniel Ferradal*
>> IT Specialist
>>
>> email         dferradal at gmail.com
>> linkedin     es.linkedin.com/in/danielferradal
>>
>
>
>
> --
> *Daniel Ferradal*
> IT Specialist
>
> email         dferradal at gmail.com
> linkedin     es.linkedin.com/in/danielferradal
>



-- 
KRegards || Jatinder Singh

Re: [users@httpd] Negate Regex with LocationMatch help Needed

Posted by Daniel <df...@gmail.com>.
My fault,  the last is a <Location /three> instead of LocationMatch

2015-05-06 16:48 GMT+02:00 Daniel <df...@gmail.com>:

> This is what I said:
>
> RedirectMatch ^/(?!one|two).* /three
> <Location /one>
>         WLSRequest On
>         WebLogicHost xxxx
>         WebLogicPort yyyy
> </Location>
>
> <Location /two>
>         WLSRequest On
>         WebLogicHost xxxx
>         WebLogicPort yyyy
> </Location>
>
> <LocationMatch /three>
>         WLSRequest On
>         WebLogicHost xxxx
>         WebLogicPort yyyy
> </LocationMatch>
>
> 2015-05-06 16:41 GMT+02:00 ਜਤਿੰਦਰ ਸਿੰਘ <ja...@gmail.com>:
>
>> I am still figuring out the workaround option as suggested with
>> redirectmatch, but i tried the greedy one like below without success.
>>
>> #<LocationMatch "^/(?!one)">
>> #<LocationMatch "^/(?!one)[^.]*">
>> <LocationMatch "^/(?!one).*">
>>
>> Tried with only "one" for testing.
>>
>> On Wed, May 6, 2015 at 2:35 AM, Daniel <df...@gmail.com> wrote:
>>
>>> Just as workaround have you tried to define the third Location as
>>> "three" and make a redirectmatch to it with the negative lookahead instead?
>>> If you still want to push for that locationmatch maybe you would need to
>>> specify a ".*" at the end.
>>>
>>> It is probably a better solution in the long run to just make a separate
>>> specific third location and redirect to it, at least i dont like to use too
>>> greedy ones.
>>> El 6/5/2015 6:02, "ਜਤਿੰਦਰ ਸਿੰਘ" <ja...@gmail.com> escribió:
>>>
>>>>
>>>> Hello Team,
>>>>
>>>> I am trying to match below conditions.
>>>>
>>>> 1) host:port/one --> matches 1st location directive only.
>>>> 2) host:port/two --> matches 2nd location directive only.
>>>> 3) All Other than host:port/one OR host:port/two --> matches 3rd
>>>> location directive (including root host:port/).
>>>>
>>>> <Location /one>
>>>>         WLSRequest On
>>>>         WebLogicHost xxxx
>>>>         WebLogicPort yyyy
>>>> </Location>
>>>>
>>>> <Location /two>
>>>>         WLSRequest On
>>>>         WebLogicHost xxxx
>>>>         WebLogicPort yyyy
>>>> </Location>
>>>>
>>>> <LocationMatch "^/(?!one|two)">
>>>>         WLSRequest On
>>>>         WebLogicHost xxxx
>>>>         WebLogicPort yyyy
>>>> </LocationMatch>
>>>>
>>>> when i try like host:port/aaa - it gives 404 as it doesnt matches any
>>>> context, however i expect it to match last one.
>>>> I have tried lot of combinations so far but doesn't seem to find it
>>>> working yet. Any suggestions Masters.
>>>>
>>>> Apache/2.4.12 (Unix)
>>>> SunOS  5.10 Generic_150400-14 sun4u sparc SUNW,Netra-T12
>>>> --
>>>> Regards || Jatinder Singh
>>>>
>>>
>>
>>
>> --
>> KRegards || Jatinder Singh
>>
>
>
>
> --
> *Daniel Ferradal*
> IT Specialist
>
> email         dferradal at gmail.com
> linkedin     es.linkedin.com/in/danielferradal
>



-- 
*Daniel Ferradal*
IT Specialist

email         dferradal at gmail.com
linkedin     es.linkedin.com/in/danielferradal

Re: [users@httpd] Negate Regex with LocationMatch help Needed

Posted by Daniel <df...@gmail.com>.
This is what I said:

RedirectMatch ^/(?!one|two).* /three
<Location /one>
        WLSRequest On
        WebLogicHost xxxx
        WebLogicPort yyyy
</Location>

<Location /two>
        WLSRequest On
        WebLogicHost xxxx
        WebLogicPort yyyy
</Location>

<LocationMatch /three>
        WLSRequest On
        WebLogicHost xxxx
        WebLogicPort yyyy
</LocationMatch>

2015-05-06 16:41 GMT+02:00 ਜਤਿੰਦਰ ਸਿੰਘ <ja...@gmail.com>:

> I am still figuring out the workaround option as suggested with
> redirectmatch, but i tried the greedy one like below without success.
>
> #<LocationMatch "^/(?!one)">
> #<LocationMatch "^/(?!one)[^.]*">
> <LocationMatch "^/(?!one).*">
>
> Tried with only "one" for testing.
>
> On Wed, May 6, 2015 at 2:35 AM, Daniel <df...@gmail.com> wrote:
>
>> Just as workaround have you tried to define the third Location as "three"
>> and make a redirectmatch to it with the negative lookahead instead? If you
>> still want to push for that locationmatch maybe you would need to specify a
>> ".*" at the end.
>>
>> It is probably a better solution in the long run to just make a separate
>> specific third location and redirect to it, at least i dont like to use too
>> greedy ones.
>> El 6/5/2015 6:02, "ਜਤਿੰਦਰ ਸਿੰਘ" <ja...@gmail.com> escribió:
>>
>>>
>>> Hello Team,
>>>
>>> I am trying to match below conditions.
>>>
>>> 1) host:port/one --> matches 1st location directive only.
>>> 2) host:port/two --> matches 2nd location directive only.
>>> 3) All Other than host:port/one OR host:port/two --> matches 3rd
>>> location directive (including root host:port/).
>>>
>>> <Location /one>
>>>         WLSRequest On
>>>         WebLogicHost xxxx
>>>         WebLogicPort yyyy
>>> </Location>
>>>
>>> <Location /two>
>>>         WLSRequest On
>>>         WebLogicHost xxxx
>>>         WebLogicPort yyyy
>>> </Location>
>>>
>>> <LocationMatch "^/(?!one|two)">
>>>         WLSRequest On
>>>         WebLogicHost xxxx
>>>         WebLogicPort yyyy
>>> </LocationMatch>
>>>
>>> when i try like host:port/aaa - it gives 404 as it doesnt matches any
>>> context, however i expect it to match last one.
>>> I have tried lot of combinations so far but doesn't seem to find it
>>> working yet. Any suggestions Masters.
>>>
>>> Apache/2.4.12 (Unix)
>>> SunOS  5.10 Generic_150400-14 sun4u sparc SUNW,Netra-T12
>>> --
>>> Regards || Jatinder Singh
>>>
>>
>
>
> --
> KRegards || Jatinder Singh
>



-- 
*Daniel Ferradal*
IT Specialist

email         dferradal at gmail.com
linkedin     es.linkedin.com/in/danielferradal

Re: [users@httpd] Negate Regex with LocationMatch help Needed

Posted by ਜਤਿੰਦਰ ਸਿੰਘ <ja...@gmail.com>.
I am still figuring out the workaround option as suggested with
redirectmatch, but i tried the greedy one like below without success.

#<LocationMatch "^/(?!one)">
#<LocationMatch "^/(?!one)[^.]*">
<LocationMatch "^/(?!one).*">

Tried with only "one" for testing.

On Wed, May 6, 2015 at 2:35 AM, Daniel <df...@gmail.com> wrote:

> Just as workaround have you tried to define the third Location as "three"
> and make a redirectmatch to it with the negative lookahead instead? If you
> still want to push for that locationmatch maybe you would need to specify a
> ".*" at the end.
>
> It is probably a better solution in the long run to just make a separate
> specific third location and redirect to it, at least i dont like to use too
> greedy ones.
> El 6/5/2015 6:02, "ਜਤਿੰਦਰ ਸਿੰਘ" <ja...@gmail.com> escribió:
>
>>
>> Hello Team,
>>
>> I am trying to match below conditions.
>>
>> 1) host:port/one --> matches 1st location directive only.
>> 2) host:port/two --> matches 2nd location directive only.
>> 3) All Other than host:port/one OR host:port/two --> matches 3rd location
>> directive (including root host:port/).
>>
>> <Location /one>
>>         WLSRequest On
>>         WebLogicHost xxxx
>>         WebLogicPort yyyy
>> </Location>
>>
>> <Location /two>
>>         WLSRequest On
>>         WebLogicHost xxxx
>>         WebLogicPort yyyy
>> </Location>
>>
>> <LocationMatch "^/(?!one|two)">
>>         WLSRequest On
>>         WebLogicHost xxxx
>>         WebLogicPort yyyy
>> </LocationMatch>
>>
>> when i try like host:port/aaa - it gives 404 as it doesnt matches any
>> context, however i expect it to match last one.
>> I have tried lot of combinations so far but doesn't seem to find it
>> working yet. Any suggestions Masters.
>>
>> Apache/2.4.12 (Unix)
>> SunOS  5.10 Generic_150400-14 sun4u sparc SUNW,Netra-T12
>> --
>> Regards || Jatinder Singh
>>
>


-- 
KRegards || Jatinder Singh

Re: [users@httpd] Negate Regex with LocationMatch help Needed

Posted by Daniel <df...@gmail.com>.
Just as workaround have you tried to define the third Location as "three"
and make a redirectmatch to it with the negative lookahead instead? If you
still want to push for that locationmatch maybe you would need to specify a
".*" at the end.

It is probably a better solution in the long run to just make a separate
specific third location and redirect to it, at least i dont like to use too
greedy ones.
El 6/5/2015 6:02, "ਜਤਿੰਦਰ ਸਿੰਘ" <ja...@gmail.com> escribió:

>
> Hello Team,
>
> I am trying to match below conditions.
>
> 1) host:port/one --> matches 1st location directive only.
> 2) host:port/two --> matches 2nd location directive only.
> 3) All Other than host:port/one OR host:port/two --> matches 3rd location
> directive (including root host:port/).
>
> <Location /one>
>         WLSRequest On
>         WebLogicHost xxxx
>         WebLogicPort yyyy
> </Location>
>
> <Location /two>
>         WLSRequest On
>         WebLogicHost xxxx
>         WebLogicPort yyyy
> </Location>
>
> <LocationMatch "^/(?!one|two)">
>         WLSRequest On
>         WebLogicHost xxxx
>         WebLogicPort yyyy
> </LocationMatch>
>
> when i try like host:port/aaa - it gives 404 as it doesnt matches any
> context, however i expect it to match last one.
> I have tried lot of combinations so far but doesn't seem to find it
> working yet. Any suggestions Masters.
>
> Apache/2.4.12 (Unix)
> SunOS  5.10 Generic_150400-14 sun4u sparc SUNW,Netra-T12
> --
> Regards || Jatinder Singh
>