What is simplest way to convert Request-URI to lowercase?

Hello,

We are using nginx heavily. We need to rewrite all request URIs
into lowercase, e.g,

http://foo.bar/ThiS_will_be_Rewritten/?q=Foobar

will be translated into

http://foo.bar/this_will_be_rewritten/?q=foobar

I know some modules (Perl, Lua) can do this. My question is
what the simplest way (module) to do that, because Perl/Lua
seems to be overkill here :wink:

Thank you very much.

ā€“
I am ā€¦ 5.5 dog years old.

On Fri, Aug 30, 2013 at 04:03:31PM +0700, Anh K. Huynh wrote:

Hi there,

We are using nginx heavily. We need to rewrite all request URIs
into lowercase, e.g,

http://foo.bar/ThiS_will_be_Rewritten/?q=Foobar

will be translated into

http://foo.bar/this_will_be_rewritten/?q=foobar

Why?

Depending on the answer, it may be more appropriate for your back-end
processor to do the conversion instead of nginx.

(Note: this isnā€™t ā€œplease justify your needsā€; this is ā€œhave you
considered the possible alternativesā€.)

If it turns out that nginx is the correct place to do this conversion,
thenā€¦

I know some modules (Perl, Lua) can do this. My question is
what the simplest way (module) to do that, because Perl/Lua
seems to be overkill here :wink:

The simplest module is the one that you (arrange to) write that does
exactly what you want and no more.

There doesnā€™t appear to be a default-distributed module that does that.

You may be able to use or adapt the module named ā€œLower Upper Caseā€
listed at NGINX 3rd Party Modules | NGINX to do what you want.

There are the general-purpose embedded language modules that you could
use ā€“ you have to decide whether the run-time ā€œoverkillā€ overhead
is more important that your build-time overhead to get the dedicated
module written.

f

Francis D. [email protected]