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

**URL:** <https://www.ruby-forum.com/t/what-is-simplest-way-to-convert-request-uri-to-lowercase/236383>\
**Category:** NGINX\
**Created:** [August 30, 2013, 11:04am UTC](https://www.ruby-forum.com/t/what-is-simplest-way-to-convert-request-uri-to-lowercase/236383 "2013-08-30T11:04:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [August 30, 2013, 11:04am UTC](https://www.ruby-forum.com/t/what-is-simplest-way-to-convert-request-uri-to-lowercase/236383/1 "2013-08-30T11:04:08Z")

</div>

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](http://foo.bar/ThiS_will_be_Rewritten/?q=Foobar)

will be translated into

[http://foo.bar/this\_will\_be\_rewritten/?q=foobar](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 😉

Thank you very much.

–  
I am … 5.5 dog years old.

---

<div class="post-metadata">

**Author:** ![Anh\_KSHuynh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@Anh\_KSHuynh](https://www.ruby-forum.com/u/Anh_KSHuynh)\
**Post date:** [August 31, 2013, 2:56pm UTC](https://www.ruby-forum.com/t/what-is-simplest-way-to-convert-request-uri-to-lowercase/236383/2 "2013-08-31T14:56:28Z")

</div>

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](http://foo.bar/ThiS_will_be_Rewritten/?q=Foobar)
> 
> will be translated into
> 
> [http://foo.bar/this\_will\_be\_rewritten/?q=foobar](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 😉

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 [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/3rdPartyModules) 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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
