Closed huksley closed 6 months ago
Youre suggesting that we should not ask about binary if there's no content type?
Currently, 304 requests processed wrong, responses have application/json Content-Type? Anyways I resorted into disabling etag in ExpressJS, resulting in no If-modified-Since sent by browser.
I think If-Modified-Since must be handled differently. Of course binary must be called only if ExpressJS actually give out body in handler.
// Disable 304 support, works wrong IMO
app.set('etag', false);
// Always send last-modified as current time
app.get('/*', function(req, res, next){
res.setHeader('Last-Modified', (new Date()).toUTCString());
next();
});
Just a thought... Maybe we can do the following:
This way, all static resources will be handled by S3 bucket
P.S. best way is to skip API GW entirely and serve them from S3 bucket/CDN directly
I mean yeah that sounds like something that could be a serverless plugin - it's def. out of scope for this library.
For the content-type stuff, it's always good to just set up an express app first and verify how it behaves, on its own.
If client issues requests with if-modified-since': 'Tue, 01 Jan 1980 00:00:00 GMT' i.e. to check whether resource have had been updated, there is no content-type header generated, but binary handler still being called:
resulting in multiple errors "No content-type header" in logs/CloudWatch.