You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by bu...@apache.org on 2016/12/04 23:43:44 UTC
[Bug 60440] New: RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
Bug ID: 60440
Summary: RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Product: Apache httpd-2
Version: 2.4.23
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Documentation
Assignee: docs@httpd.apache.org
Reporter: chris2k01@hotmail.com
Target Milestone: ---
I have mod_dbd set up to talk to a PostgreSQL database. This works, albeit not
doing anything useful:
RewriteMap mymap "dbd:SELECT %s"
RewriteRule ^/(.*)$ /${mymap:$1} [R]
This fails, indicating that every request failed SQL map lookup:
RewriteMap myMap "dbd:SELECT %s"
RewriteRule ^/(.*)$ /${myMap:$1} [R]
The documentation does not say that map names have to be all-lowercase, but it
seems they do, at least in the dbd-PostgreSQL case.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
[Bug 60440] RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
--- Comment #5 from Nick Kew <ni...@webthing.com> ---
Sounds reasonable to add a note in rewritemap.html. Is there anywhere else we
should look at in the docs?
(note to self: in these days of socache, we can do better than just dbd and
fastdbd options. Something to implement there)!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
[Bug 60440] RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
--- Comment #2 from Christopher Head <ch...@chead.ca> ---
Here are some log lines taken with rewrite:trace8 for a request to
https://test.example.com/test.html (I anonymized the server name and my own
client IP address, but nothing else has been changed) using an all-lowercase
map, which succeeds (CURL indicates that a 302 is sent with the location
/test.html, as expected):
[Sat Dec 17 12:53:52.481799 2016] [rewrite:trace2] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial]
init rewrite engine with requested uri /test.html
[Sat Dec 17 12:53:52.481849 2016] [rewrite:trace3] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial]
applying pattern '/(.*)$' to uri '/test.html'
[Sat Dec 17 12:53:52.482238 2016] [rewrite:trace5] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial] SQL
map lookup OK: map mymap key=test.html, val=test.html
[Sat Dec 17 12:53:52.482262 2016] [rewrite:trace2] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial]
rewrite '/test.html' -> '/test.html'
[Sat Dec 17 12:53:52.482289 2016] [rewrite:trace2] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial]
explicitly forcing redirect with https://test.example.com/test.html
[Sat Dec 17 12:53:52.482305 2016] [rewrite:trace1] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial]
escaping https://test.example.com/test.html for redirect
[Sat Dec 17 12:53:52.482321 2016] [rewrite:trace1] [pid 18625:tid
140248097462016] mod_rewrite.c(477): [client 123.123.123.123:42252]
123.123.123.123 - - [test.example.com/sid#a33370][rid#7f8df8012260/initial]
redirect to https://test.example.com/test.html [REDIRECT/302]
Here are some log lines with mymap changed to myMap, which fails (CURL
indicates that a 302 is sent but with location /):
[Sat Dec 17 12:55:53.361498 2016] [rewrite:trace2] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial]
init rewrite engine with requested uri /test.html
[Sat Dec 17 12:55:53.361548 2016] [rewrite:trace3] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial]
applying pattern '/(.*)$' to uri '/test.html'
[Sat Dec 17 12:55:53.461887 2016] [rewrite:trace5] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial] SQL
map lookup FAILED: map myMap key=test.html
[Sat Dec 17 12:55:53.461907 2016] [rewrite:trace2] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial]
rewrite '/test.html' -> '/'
[Sat Dec 17 12:55:53.461923 2016] [rewrite:trace2] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial]
explicitly forcing redirect with https://test.example.com/
[Sat Dec 17 12:55:53.461938 2016] [rewrite:trace1] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial]
escaping https://test.example.com/ for redirect
[Sat Dec 17 12:55:53.461952 2016] [rewrite:trace1] [pid 18735:tid
140247996299008] mod_rewrite.c(477): [client 123.123.123.123:42274]
123.123.123.123 - - [test.example.com/sid#a11140][rid#7f8df8012260/initial]
redirect to https://test.example.com/ [REDIRECT/302]
Here is the contents of the relevant VirtualHost entry:
ServerAdmin webmaster@example.com
DocumentRoot "/var/www/test.example.com/htdocs"
<Directory /var/www/test.example.com/htdocs>
Require all granted
</Directory>
DBDriver pgsql
DBDParams "postgresql://apache@/mydb"
RewriteEngine on
RewriteMap mymap "dbd:SELECT %s"
RewriteRule "/(.*)$" /${mymap:$1} [R]
LogLevel rewrite:trace8
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
[Bug 60440] RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
Christopher Head <ch...@chead.ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #4 from Christopher Head <ch...@chead.ca> ---
Nope, that syntax doesn’t work either:
Internal error (specific information not available): AH00632: failed to prepare
SQL statements: ERROR: column "$1" does not exist\nLINE 1: PREPARE myMap
(varchar) AS SELECT "$1"\n ^\n
I understand that this limitation comes from PostgreSQL. The thing is, from the
Apache documentation, I had no idea that PostgreSQL would ever even *see* the
map name! From looking at the mod_rewrite documentation, it’s written as if the
rewrite map name is purely a private identifier used by Apache itself.
Documenting the specific requirements for rewrite map names for each database
is definitely silly, I agree. Documenting that the rewrite map name *will be
used as a database identifier*, and therefore must obey the DBMS-specific rules
of same, and to please look at your DBMS for details, IMO makes perfect sense,
and is something I would never have guessed just from looking at the
mod_rewrite documentation today.
I’ve reopened this ticket with that idea in mind, but if you don’t want to edit
accordingly, you can close again.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
[Bug 60440] RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
--- Comment #1 from Rich Bowen <rb...@apache.org> ---
Can you please provide all of the relevant/related log file entries go to along
with this? Thanks.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
[Bug 60440] RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
Christophe JAILLET <ch...@wanadoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Christophe JAILLET <ch...@wanadoo.fr> ---
Hi,
apparently, this is the way PostgreSQL works. It turns identifier in lowercase,
if not double-quoted.
See:
https://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html (§4.1.1)
and
https://stackoverflow.com/questions/20878932/are-postgresql-column-names-case-sensitive
So in your case, if the myMap has been created with double-quotes, you must
have the double-quotes somewhere.
I guess that:
RewriteMap mymap "dbd:SELECT \"%s\""
or something similar would work for you.
I don't see anything wrong with Apache itself here, so closing as INVALID.
Updating the doc makes also little sense to me, as it is the way PostgreSQL
works. We can not handle in our doc all the subtleties of other software.
If you can try the alternative syntax, please share your results here.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
[Bug 60440] RewriteMap map name fails if not all lowercase with
PostgreSQL DBD map
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60440
Nick Kew <ni...@webthing.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Nick Kew <ni...@webthing.com> ---
Added a note as suggested. See r1828121
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org