ruby on rails - Post returns 405 method not allowed -


i having issue rails localhost server, post calls started returning 405 method not allowed. however there no problems on our staging , production servers. happening on branches of code ones have not been updated. when debugging see reaches routes file not controller.

i have tried removing gems , reinstalling, switching webrick pama, creating new clone of git project.

server

started post "/assets" ::1 @ 2015-07-14 12:14:27 -0400 

network tab in chrome

general

remote address:[::1]:3000 request url:http://localhost:3000/assets request method:post status code:405 method not allowed 

response

http/1.1 405 method not allowed cache-control:no-cache content-length:18 content-type:text/plain x-request-id:9b0b2dd2-065b-4610-91c9-36494ea95353 x-runtime:0.145368 

request

post /assets http/1.1 accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8     accept-encoding:gzip, deflate     accept-language:en-us,en;q=0.8     cache-control:no-cache     connection:keep-alive     content-length:8376627     content-type:multipart/form-data; boundary=----webkitformboundaryx8y8pbysdt7dxs4a     cookie:activeaccordiongroup=collapsetwo; _fusion360_hub_session=bah7b0kid3nlc3npb25fawqgogzfrkkijwflymvlogzjzmi3yzvlyjbjnjayyzcymznhnziymziwbjsavekief9jc3jmx3rva2vubjsarkkimtllm2xhk1k4wg1hd2xynnzcoethoehpahntbwqvzgr2cgj3bu9wuxiwrzg9bjsarg%3d%3d--4e108cb5f6eca3d986c0b3accec07bd2c27560b2; _mkto_trk=id:760-cwr-293&token:_mch-localhost-1435859445290-79614; _pk_id.845225.1fff=9847e7981c291a08.1435859445.1.1435859445.1435859445.; _allegorithmic-substance-marketplace_session=m3dmucs4zetwstfjtfvhv2vyn2pesfdhcglhl2grvvvksgxiwez3mlhxqkprdhe2l0zkmfpurmzdwgl6atmxysttmxfsqxn2m08zvvvxztrhmdnkohjouza1tmzoynmwwurjb3c0rkx6mtjyow1uem9angrobemvc1npswo5vnq4duizrnrttfpnmlpoqvvzuu1sdwxin1zjn1limvd3sk5jaxkyzkzlz3duwtc4k2dnk0fsk29jvwdva2t0eun1q3hjbjferhjvagtndjvowgxdrulndz09ls1rzddwcmtewhljwhrpzjc1mfnusdf3pt0%3d--d34962721f449064dfdfd4629c0239ea1340aee4; __profilin=p%3dt     host:localhost:3000     origin:http://localhost:3000     pragma:no-cache     referer:http://localhost:3000/assets/new     user-agent:mozilla/5.0 (macintosh; intel mac os x 10_9_5) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.132 safari/537.36 

you have route "assets", reserved route in rails , reserved rails asset pipeline.

if must use "assets" route need give asset pipeline mount point adding following line in development.rb or production.rb configuration block:

config.assets.prefix = '/assetz' 

and restart server.

by assets mounted on "/assetz" , able use post requests on "/assets".

happy coding!

reference:

1) stackoverflow


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -