Heroku and Django with 405 error

寵の児 提交于 2020-01-03 08:13:52

问题


I am trying to move my django project from an apache setup over to heroku. At this point, everything seems to be working fine except for an issue I am having with using the PATCH Http Method (which I use in conjuction with django-tastypie).

I have a piece of middleware that allows this method and it worked on the apache server I had before. Now all I get is a 405 (METHOD_NOT_ALLOWED) error. The common HTTP methods still work (GET, POST, DELETE, POST). I also have read that nginx doesn't support OPTIONS (and maybe PATCH requests?) by default and some configuring has to be done. From what I have read, nginx returns a similar 405 error for OPTIONS method requests. I am also pretty sure heroku uses an nginx frontend, so that could be the issue.

This leads me to my next issue: I have no idea how to add my own headers to it because that is all controlled by heroku. Does anyone know exactly what the issue is? Is there any way, aside from abandoning the PATCH method (which makes things much more convenient), to get the PATCH method to work on heroku?


回答1:


Patch is currently not supported on Heroku. It is not due to an nginx issue, but rather due to an issue in the routing layer. It is something Heroku is currently working on, but there is no ETA on it being available. Additionally you do not have the ability to add custom headers as these are controlled for you.



来源:https://stackoverflow.com/questions/10069871/heroku-and-django-with-405-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!