Post returns 405 method not allowed

前端 未结 3 1842
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 02:01

I am having an issue with my Rails localhost Server, all Post calls started returning 405 method not allowed. However there are no problems on our staging and production

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-19 02:27

    You have a route "assets", which is a reserved route in Rails and it is reserved for Rails Asset Pipeline.

    If you must use the "assets" route then you need to give Asset Pipeline another mount point by adding the following line in your development.rb or production.rb configuration block:

    config.assets.prefix = '/assetz'
    

    And restart your server.

    By this all your assets will be mounted on "/assetz" and you will be able to use POST requests on "/assets".

    Happy coding!

    Reference:

    1) StackOverflow

提交回复
热议问题