Forum: NGINX 400 bad request and utf8

4b991e6bc2c354df945713544f637f63?d=identicon&s=25 john lee (optimumdulopin)
on 2013-09-25 14:17

Im using nginx and rails for my site which contains url with georgian
letters ie განცხადებები so something like
It is mainly working perfectly but sometimes I receive request with
truncated url ie
1 -
(as u can see it should be something after %9)
2 -

I succeeded to deal when there is no get parameters (first url above)
and make in that case a redirection to /
when this happen, this line is added to nginx error.log
2013/09/24 00:46:53 [alert] 63547#0: *19359227 pcre_exec() failed: -10
on "/ka/განცხადებებ�" using "", client:, server:, request: "GET
HTTP/1.1", host: ""

but for second url, which have get parameter truncated, I can not handle
that which generate a 400 bad request page.
such request added this line in nginx access.log - - [24/Sep/2013:00:48:47 +0200] "GET
HTTP/1.1" 400 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"

does this mean that nginx accepted the request and then rails coudnt
resolve it ?

I don't know if problem come from rails or from nginx. For first url, I
solved it in nginx conf
here part of my conf

    access_log /var/log/nginx/gancx.access.log;
    error_log /var/log/nginx/gancx.error.log;

    client_body_in_file_only clean;
    client_body_buffer_size 32K;
    charset UTF-8;
    source_charset UTF-8;
    client_max_body_size 300M;

    error_page  400 404         = @notfound;
    error_page  500 502 504 = @server_error;
    error_page  503         = @maintenance;

    location @notfound {
      rewrite ^(.*)$ $scheme://$host permanent;

    location @server_error {
        rewrite ^(.*)$ $scheme://$host permanent;

    location @maintenance {
        rewrite ^(.*)$ $scheme://$host permanent;
    sendfile on;
    send_timeout 300s;

    location / {
        proxy_pass http://gancx;
        proxy_redirect off;

        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        charset UTF-8;
        client_max_body_size 7m;
        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;

thanks for your help
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.