Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread sebb
On Mon, 8 May 2023 at 19:00, Eric Covener  wrote:
>
> On Mon, May 8, 2023 at 1:22 PM sebb  wrote:
> >
> > Another issue is that there is no link to the syntax to be used for
> > the various conditions.
> >
> > For example, how does on express a file/path test or a string comparison?
> > AFAICT the only example is for a regex, though that is not made explicit.
>
> Are you still in the intro document?

yes.

> The comprehensive doc is
> https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond

Although there is a link to the full doc, it could be made more explicit.

Also the intro says "the second argument is a regular expression that
must match the variable". This is not the whole story. It would help
to be explicit in the text that there are 3 types of condition, at
which point a link to the full docs would be useful.

> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread Eric Covener
On Mon, May 8, 2023 at 1:22 PM sebb  wrote:
>
> Another issue is that there is no link to the syntax to be used for
> the various conditions.
>
> For example, how does on express a file/path test or a string comparison?
> AFAICT the only example is for a regex, though that is not made explicit.

Are you still in the intro document?

The comprehensive doc is
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread sebb
Another issue is that there is no link to the syntax to be used for
the various conditions.

For example, how does on express a file/path test or a string comparison?
AFAICT the only example is for a regex, though that is not made explicit.

Sebb

On Mon, 8 May 2023 at 15:38, Daniel Gruno  wrote:
>
> On 2023-05-08 09:33, Eric Covener wrote:
> > On Mon, May 8, 2023 at 10:29 AM Daniel Gruno  wrote:
> >>
> >> On 2023-05-08 08:44, Eric Covener wrote:
> >>> On Mon, May 8, 2023 at 9:41 AM Frank Gingras  wrote:
> 
>  Sebb,
> 
>  Are you sure about that? I would verify before we venture to clarify the 
>  docs.
> >>>
> >>> I think sebb is right, I've occasionally had to try to weirdly
> >>> propagate it or delay/combine it.
> >>>
> >>> In a rule or condition, the captures of the preceding condition is 
> >>> available
> >>
> >> Only if the next condition is a regex condition. A literal string
> >> comparison condition will not reset the previous captures. And yeah, you
> >> can use the teststring value to add back your captures from the previous
> >> condition:
> >>
> >> # Get key value into %1
> >> RewriteCond %{QUERY_STRING} "key=(.+)"
> >> # Append query string with %1, get key value back into %1, bar value into 
> >> %2
> >> RewriteCond %1::%{QUERY_STRING} "^(.+)::.*bar=(.+)"
> >> # Literal comparison, doesn't change backrefs:
> >> RewriteCond %2 ="foo"
> >> RewriteRule .* http://foo.bar/%1/%2
> >
> > Ah, cool and tricky to document in an "intro".  Maybe we can make sure
> > the gory details are right elsewhere, and caution that it's more
> > complicated with multiple conditions in the intro example.
>
> Yeah, you can actually use this to accept and parse query string
> key/value pairs given in an arbitrary order, but as you say, it gets
> complex real fast - I am having to resort to making RewriteCond macros
> to accomplish this without having to write 200 lines of config :)
>
> We do have a page dedicated to advanced usage examples, maybe I can add
> something to that page.
>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> > For additional commands, e-mail: users-h...@httpd.apache.org
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread Daniel Gruno

On 2023-05-08 09:33, Eric Covener wrote:

On Mon, May 8, 2023 at 10:29 AM Daniel Gruno  wrote:


On 2023-05-08 08:44, Eric Covener wrote:

On Mon, May 8, 2023 at 9:41 AM Frank Gingras  wrote:


Sebb,

Are you sure about that? I would verify before we venture to clarify the docs.


I think sebb is right, I've occasionally had to try to weirdly
propagate it or delay/combine it.

In a rule or condition, the captures of the preceding condition is available


Only if the next condition is a regex condition. A literal string
comparison condition will not reset the previous captures. And yeah, you
can use the teststring value to add back your captures from the previous
condition:

# Get key value into %1
RewriteCond %{QUERY_STRING} "key=(.+)"
# Append query string with %1, get key value back into %1, bar value into %2
RewriteCond %1::%{QUERY_STRING} "^(.+)::.*bar=(.+)"
# Literal comparison, doesn't change backrefs:
RewriteCond %2 ="foo"
RewriteRule .* http://foo.bar/%1/%2


Ah, cool and tricky to document in an "intro".  Maybe we can make sure
the gory details are right elsewhere, and caution that it's more
complicated with multiple conditions in the intro example.


Yeah, you can actually use this to accept and parse query string 
key/value pairs given in an arbitrary order, but as you say, it gets 
complex real fast - I am having to resort to making RewriteCond macros 
to accomplish this without having to write 200 lines of config :)


We do have a page dedicated to advanced usage examples, maybe I can add 
something to that page.




-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread Eric Covener
On Mon, May 8, 2023 at 10:29 AM Daniel Gruno  wrote:
>
> On 2023-05-08 08:44, Eric Covener wrote:
> > On Mon, May 8, 2023 at 9:41 AM Frank Gingras  wrote:
> >>
> >> Sebb,
> >>
> >> Are you sure about that? I would verify before we venture to clarify the 
> >> docs.
> >
> > I think sebb is right, I've occasionally had to try to weirdly
> > propagate it or delay/combine it.
> >
> > In a rule or condition, the captures of the preceding condition is available
>
> Only if the next condition is a regex condition. A literal string
> comparison condition will not reset the previous captures. And yeah, you
> can use the teststring value to add back your captures from the previous
> condition:
>
> # Get key value into %1
> RewriteCond %{QUERY_STRING} "key=(.+)"
> # Append query string with %1, get key value back into %1, bar value into %2
> RewriteCond %1::%{QUERY_STRING} "^(.+)::.*bar=(.+)"
> # Literal comparison, doesn't change backrefs:
> RewriteCond %2 ="foo"
> RewriteRule .* http://foo.bar/%1/%2

Ah, cool and tricky to document in an "intro".  Maybe we can make sure
the gory details are right elsewhere, and caution that it's more
complicated with multiple conditions in the intro example.

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread Daniel Gruno

On 2023-05-08 08:44, Eric Covener wrote:

On Mon, May 8, 2023 at 9:41 AM Frank Gingras  wrote:


Sebb,

Are you sure about that? I would verify before we venture to clarify the docs.


I think sebb is right, I've occasionally had to try to weirdly
propagate it or delay/combine it.

In a rule or condition, the captures of the preceding condition is available


Only if the next condition is a regex condition. A literal string 
comparison condition will not reset the previous captures. And yeah, you 
can use the teststring value to add back your captures from the previous 
condition:


# Get key value into %1
RewriteCond %{QUERY_STRING} "key=(.+)"
# Append query string with %1, get key value back into %1, bar value into %2
RewriteCond %1::%{QUERY_STRING} "^(.+)::.*bar=(.+)"
# Literal comparison, doesn't change backrefs:
RewriteCond %2 ="foo"
RewriteRule .* http://foo.bar/%1/%2




-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread Eric Covener
On Mon, May 8, 2023 at 9:41 AM Frank Gingras  wrote:
>
> Sebb,
>
> Are you sure about that? I would verify before we venture to clarify the docs.

I think sebb is right, I've occasionally had to try to weirdly
propagate it or delay/combine it.

In a rule or condition, the captures of the preceding condition is available

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Unclear RewriteCond docs

2023-05-08 Thread Frank Gingras
Sebb,

Are you sure about that? I would verify before we venture to clarify the
docs.

On Mon, May 8, 2023 at 5:28 AM sebb  wrote:

> https://httpd.apache.org/docs/current/rewrite/intro.html#rewritecond says
>
> “Matches in the regular expressions contained in the RewriteConds can
> be used as part of the Substitution in the RewriteRule using the
> variables %1, %2, etc.“
>
> This implies that more than one RewriteCond can be involved in
> providing variables for the following rule.
>
> However, unless I am missing something, only the last RewriteCond can
> provide any variables.
>
> It would be helpful if the docs could be more explicit on this.
>
> Sebb
>
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>


[users@httpd] Unclear RewriteCond docs

2023-05-08 Thread sebb
https://httpd.apache.org/docs/current/rewrite/intro.html#rewritecond says

“Matches in the regular expressions contained in the RewriteConds can
be used as part of the Substitution in the RewriteRule using the
variables %1, %2, etc.“

This implies that more than one RewriteCond can be involved in
providing variables for the following rule.

However, unless I am missing something, only the last RewriteCond can
provide any variables.

It would be helpful if the docs could be more explicit on this.

Sebb

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Strange behavior with directives ProxyRemote and NoProxy

2023-05-08 Thread Carsten Klein

Hi there,

Update: AFAICS, Debian/Ubuntu patches do nothing with NoProxy.

I've tested this on a different server (also an Ubuntu 22.04 LTS box 
with Apache httpd 2.4.52) in a completely different network. The NoProxy 
directive behaves slightly different on that host.


On that host, NoProxy seems to have absolutely NO effect. No matter what 
I'm configuring, the ProxyRemote is ALWAYS used. (On the other host, I 
could prevent ProxyRemote from being used by adding my local domain or 
the local subnet to NoProxy).


ON the new host, I've tried with domains, hostnames, IP-Addresses, 
Subnets... (DNS works fine on that server for all hosts).


Anyone has an idea what's wrong with that configuration?


ProxyRemote "https" "http://192.168.2.1:3128";
NoProxy ".geoportal-raumordnung-bw.de"

ProxyPass   "/foo/bar" 
"https://www.geoportal-raumordnung-bw.de/ows/services/org.1.09570b44-6616-4482-8680-90743239483d_wms";


Actually, this configuration uses the proxy server 192.168.2.1:3128 for 
any requests to "/foo/bar".



Maybe reading in the NoProxy configuration is somehow broken? Too bad, 
that most of the debug statements in set_proxy_dirconn (mod_proxy.c) are 
located inside an ´#if DEBUGGING´ condition. So, I have no way to see 
those with my standard binaries.


Has anyone out there actually managed to use ProxyRemote together with 
NoProxy in a useful way?


Regards,

Carsten

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org