rewrite utf8 : why lower case

Francis Daly francis at daoine.org
Sun Jun 2 14:07:41 UTC 2013


On Sun, Jun 02, 2013 at 03:33:34PM +0200, optimum.dulopin at laposte.net wrote:

Hi there,

> I have some routes that was previously with uppercase for language and now I want lowrcase. here is a route : /Ka/განცხადებები that should simply become /ka/განცხადებები
> 
> in my conf if ($uri ~ ^/K(.+)){ set $bb $1; rewrite ^(.*)$ $scheme://$host/k$bb permanent; }
> 
> and I cant understand why but /ka/%E1%83%92%E1%83%90%E1%83%9C%E1%83%AA%E1%83%AE%E1%83%90%E1%83%93%E1%83%94%E1%83%91%E1%83%94%E1%83%91%E1%83%98/
> 
> become
> 
> /ka/%e1%83%92%e1%83%90%e1%83%9c%e1%83%aa%e1%83%ae%e1%83%90%e1%83%93%e1%83%94%e1%83%91%e1%83%94%e1%83%91%e1%83%98
> 
> ie all uppercase letter become lowercase, that cause à pb with my rails app.
> 
> does anyone know why nginx do this ? and is it possible to block this ?

As I understand it: %AA and %aa are exactly equivalent in a url. nginx
rewrite has to pick something, and chooses to use lowercase. I don't
think there is a config-file way to control this.

(AA and aa are different; but the percent encoding is case-insensitive.)

You could try patching your nginx to make it choose to use uppercase,
but that is unlikely to be very useful going forward.

The best I can suggest is that if your rails app handles %AA and %aa
differently, that's a bug in your rails app that might be easier for
you to fix.

> I can't just uppercase everything as there is some latin letter and my routes are case sensitive

urls are case-sensitive *after* the %-decoding has happened.

Before %-decoding, "%2E", "%2e", and "." are all equivalent, so requests
for "/a.png", "/a%2Epng", and "/a%2epn%67" should be handled identically.

Can you get your rails app to only consider the after-decoding request
"/ka/განცხადებები" for routing?

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list