I'm running a rails application which sits atop passenger and nginx. We have an issue with slashes reaching routes.rb decoded. What I mean is, if I run a local rails server, no nginx and make a request to:
/v1/fruit/jayamthi%2Fceria@gmail.com
Then the following routes.rb snippet will not see the %2F as a slash:
scope 'v1/:service', :fruit => valid_fruit,
:via => :get,
:controller => :fruit do
constraints(:q => /[^\/]+/i) do
...
If I run the same request through nginx and passenger then the above snippet will treat the %2F as a slash and the consequent matches are looking at the wrong thing. So, what's the deal with nginx and slashes?
P.S here's my nginx configuration:
upstream app_cluster_1 {
server 127.0.0.1:4000;
server 127.0.0.1:4001;
}
server {
listen 80;
server_name staging.fruity.com fruity;
location ~* ^\/resque {
root /var/www/fruity/current/public;
passenger_enabled on;
}
location /v1 {
passenger_enabled on;
root /var/www/fruity/current/public;
rack_env production;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://app_cluster_1;
proxy_redirect off;
}
}