ruby - Rails: Ajax local works fine, but 404 in nginx server -


in js file :

function jqshowresourcesselection( elem, select_id ) {     if (elem.checked){         $("#" + select_id).attr("disabled","disabled");         $.ajax({             url: '/testbeds/resources_selection',             type: 'post',             datatype : 'script',             data: {"configuration_id": $("#" + select_id).val()},             success: function() {                 addfilter();             }         });     }     else {         $("#testbed_configuration_id").attr("disabled", false);         $("#resourcesselection").html('');     } } 

in routes.rb

resourcemanager::application.routes.draw   resources :testbeds     collection       post :resources_selection     end   end   resources :resources   resources :configurations    ...................    root :to => 'configurations#index'  end 

it works fine in local machine, both development , production environment. in server, nginx, after trigger js function, chrome console show:

post http://example.com/testbeds/resources_selection 404 (not found) 

i tried "post" "get":

function jqshowresourcesselection( elem, select_id ) {     if (elem.checked){         $("#" + select_id).attr("disabled","disabled");         $.ajax({             url: '/testbeds/resources_selection.js',             type: 'get',             data: {"configuration_id": $("#" + select_id).val()},             success: function() {                 addfilter();             }         });     }     else {         $("#testbed_configuration_id").attr("disabled", false);         $("#resourcesselection").html('');     } } 

routes.rb:

resourcemanager::application.routes.draw   resources :testbeds     collection       :resources_selection     end   end  ...........................  end 

it works fine in local no matter development or production environment. still 404 in server after checked checkbox.

and ngnix config below:

http {     passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18;     passenger_ruby /usr/local/bin/ruby;      include       mime.types;     default_type  application/octet-stream;      sendfile        on;     keepalive_timeout  65;      server {         listen 80;         server_name cth-infra-07.datadomain.com 10.110.131.4 localhost;         root /var/www/webapps/;         rack_env production;         passenger_enabled on;         passenger_base_uri /resource_manager;         passenger_base_uri /request_handler;         passenger_base_uri /scheduler;         passenger_base_uri /resque;         passenger_base_uri /central_server;     } 

can 1 me ? thanks.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -