Welcome! Log In Create A New Profile

Advanced

Re: rewrite utf8 : why lower case

Francis Daly
June 02, 2013 10:08AM
On Sun, Jun 02, 2013 at 03:33:34PM +0200, optimum.dulopin@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@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

rewrite utf8 : why lower case

Anonymous User June 02, 2013 09:34AM

Re: rewrite utf8 : why lower case

Francis Daly June 02, 2013 10:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 205
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready