1

i am using SEARCH because i would like the equivalent of GET (idempotent) but with a request body. this is because i'd rather submit my request body as JSON instead of serializing to URL query parameters.

i'm making requests to a cloud run service, but i don't see my requests in my service logs. however, the requests are coming through a cloud load balancer, and there, i do see the requests, with statusDetails: "response_sent_by_backend" which google says means the load balancer is not generating the response.

so, somewhere between the LB and my service, something else returns a 502, but I can't find any logs about it. anyone know how to trouble-shoot? alternatively, is there something else i can do to make GET-style requests with a JSON body?

Igor Serebryany
  • 3,307
  • 3
  • 29
  • 41

1 Answers1

1

Welp, I haven't heard anything. I wanted to try using QUERY instead of search, since it looks like QUERY is IETF-standards-track for an idempotent method with a body, but my backend is a nodejs express server, and express does not support QUERY. So, I couldn't test whether or not Google's infra supports QUERY.

Instead, I changed my SEARCH requests to PUT, since at least PUT is considered idempotent, even if it's not considered safe. I added a X-HTTP-Method-Override: SEARCH header to my new PUT requests, and then used the method-override package to rewrite them back to SEARCH so I didn't have to change my controllers:

  app.use(methodOverride('X-HTTP-Method-Override', { methods: ['PUT'] }))

This seems to satisfy both google's load balancing infra and express, so I'm sticking with it for now until the relevant IETF standards advance.

Igor Serebryany
  • 3,307
  • 3
  • 29
  • 41