1

I have configured my GET API via AWS API Gateway. The endpoint is running a Jersey 2.x REST service.

The client is unable to insert an 'Accept' header, and the API Gateway sees fit to insert its own 'Accept':'application/json' header.

This causes the server to fail the request with HTTP 406, as the server-side API has a '@Produces(MediaType.APPLICATION_OCTET_STREAM' notation.

Does anyone have any idea of how I can stop the API Gateway from doing this without resorting to Lambda?

Earthling
  • 283
  • 5
  • 17

1 Answers1

2

You can override this by adding a header in the Integration Request. You add the header name Accept and then set the value to empty single quotes ''. This should send a blank Accept header to the endpoint.

Or you can set the value to something else if necessary, just use single quotes as above 'application/octet-stream'

jackko
  • 6,998
  • 26
  • 38
  • I'd tried this previously, but due to a bug in APIG, the returned 'Content-Type' value was coming back from APIG as '\*/\*'. After raising a support ticket, all is well now. :) – Earthling Feb 16 '17 at 02:59
  • Care to update with the solution from support then? Thanks! – jackko Feb 17 '17 at 18:00
  • Well, Support basically said that what I tried, which is similar to your suggested answer, was correct, and they deployed new code to APIG to resolve the bug. – Earthling Feb 17 '17 at 18:02