-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hi there!
I've been using utf8-cleaner for quite a while. To be honest I don't quite know if it has had any effect in the application - I put it 'just in case' given that it seems a well maintained gem, and I was experiencing requests with problematic encodings.
Theoretically if I use utf8-cleaner, no request URL encoding should ever cause a 500, right?
Well, I am able to consistently reproduce this in my app:
curl -I `ruby -e "puts %|https://www.myapp.com/foo/bar\?abcdt\=\x80\xC2\\@7ok_id\=130|"`
HTTP/1.1 500 Internal Server Error
(anonimized domain/route/params)
Internaly the error is:
ActionView::Template::Error: incompatible character encodings: UTF-8 and ASCII-8BIT
Unfortunately I cannot reproduce this on my machine; I am able to consistently reproduce it in production though.
Setup 1 (localhost, not reproducible)
Plain Rails server:
curl -I `ruby -e "puts %|http://localhost:3000/foo/bar\?abcdt\=\x80\xC2\\@7ok_id\=130|"`
HTTP/1.1 200 OK
Setup 2 (localhost, not reproducible)
Rails server behind local instance of nginx.
curl -I `ruby -e "puts %|http://localhost:8080/foo/bar\?abcdt\=\x80\xC2\\@7ok_id\=130|"`
HTTP/1.1 200 OK
Setup 3 (production, reproducible)
Cloudflare -> AWS ELB -> nginx -> Rails server
curl -I `ruby -e "puts %|https://www.myapp.com/foo/bar\?abcdt\=\x80\xC2\\@7ok_id\=130|"`
HTTP/1.1 500 Internal Server Error
My point is that maybe Cloudflare/ELB are doing something funny.
Let me know if I can do anything to help debugging the issue.
Cheers - Victor