Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google compute load balancer throws 400 Bad Request on DELETE

I created an instance group through an instance template, and aligned this instance group to a backend service which is used by a http load balancer.

Now when I open a url to an instance vm from the instance group I created, I can do GET POST and DELETE requests and all of the requests are fast, and everything works as expected.

When I open up the url to the static IP for the load balancer. I can do GET and POST requests, but DELETE requests throw a 400 BAD REQUEST with a response page saying:

That’s an error.

Your client has issued a malformed or illegal request. That’s all we know.

Other load balancer issues:

  • The site is quite slow through the load balancer. Perhaps there is a setting I'm missing, I'm pretty sure I set everything to us-central-1b.
  • Sometimes the site doesn't even show up. It will work for http, but then it won't work for https and visa versa. The load balancer has very strange behaviour.

My VM api access is set to This instance has full API access to all Google Cloud services

I'm using Django as my api layer, I turned on debugging on this host and saw that the DELETE requests weren't even coming through when making requests through the loadbalancer static ip. Is there a firewall setting I'm missing?

Please help me make this fast again and allow the DELETE requests to happen.

Thanks!

like image 814
Matthew Harrison Avatar asked Dec 19 '22 18:12

Matthew Harrison


1 Answers

Are you sending anything in the body of the request?

Google load balancer will respond with 400 BAD REQUEST if you try to send anything in the body. Easy way to check if this is the problem is fire up Chrome Developer tools and check the Request Payload section is empty/doesn't exist.

The HTTP spec doesn't explicitly say wether you can pass anything in the body so this isn't wrong, just undefined.

Is the load balancer slow for all requests or just pages with lots of elements on?

like image 177
Ian Chadwick Avatar answered Jan 13 '23 12:01

Ian Chadwick