I have CloudFront configured with an API Gateway origin. In the application accessed via API Gateway, my application responds to a particular request with a Content-Disposition header so that the data is downloaded as an attachment with a particular filename.
If I directly access my web application, the Content-Disposition header is returned as expected. But if I access it through CloudFront, that header is not in the response at all.
I can't figure out why this is - why does CloudFront disregard a header sent back from this origin? I've tried several things:
- Adding a custom header (Content-Disposition with a blank value) to the origin. This caused the header to appear in the response, but with no value. I was hoping that adding the header here would indicate to CloudFront that the header should be included in the response
- Creating a new response header policy, just in case the default ones were somehow configured to ignore this header
- Tried creating a new Origin Request Policy, just for completeness
There doesn't seem to be a problem with other headers being passed through (cookie headers, content type, etc).
Does anyone know what could cause this header to be silently disposed of by CloudFront? Or is there any way to debug this in greater detail so I can see where the problem could be?