My iOS app makes POST requests to Google Cloud Run container which hosts my Django Rest Framework Project.
To add a layer of security I’ve set up public ESP (Extensible Service Proxy - Cloud Endpoints) to serve as a gateway for private Cloud Run Container. Basically, ESP does authentication before routing the request to private Cloud Run container.
All GET requests to ESP work fine: they successfully get routed to Cloud Run Container (for example when I request non existing /hello at www.example.com/hello, I get Django Debug 404)
However, for some reason, POST requests are not routed by ESP (for example I’m trying to access existing /upload at www.example.com/upload I get standard 404), and ESP logs show the request never made it to Cloud Run container.
I’ve tried disabling csrf, setting APPEND_SLASH to false, nothing seems to work. All POST requests result in 404.
Am I doing something wrong in Django?
All POST requests work fine if sent directly to Cloud Run Container
You aren’t running with DEBUG=True in production are you?
This makes it really sound like the problem with ESP, rather than in Django anywhere.
I’ve never heard of ESP before but I checked its docs and it says it takes an Open API config file. Did you upload that, and does yours allow POST to your endpoints?
How do you send POST requests? Via JavaScript? Is it fetch or axios or anything else? Check in Chrome Dev Tools if your request leaves the browser at all.