I’ve got a Rails app that must send an POST .js request, but Nginx raise a 404 error on a POST request to something.js
I found out it came from my config file
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires max;
}
I tried to modify it this way (look at the location )
location ~* \.(jpeg|jpg|gif|css|png|js|ico)$ {
access_log off;
expires max;
}
And according to Nginx raises 404 when using format => 'js', i also tried this :
location ~* \.(jpeg|jpg|gif|css|png|js|ico)$ {
access_log off;
expires max;
break;
}
But none of the previous configuration worked out.
Thank you per advance
This nginx config should only apply to static JS (and CSS files), not to your Rails actions.
In this case you try to post to a static file, which obviously does not exist.
All your assets (including CSS and JS files) will be in
public/assets.I successfully use this configuration: