![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@schibsted/middy-caching-headers
Advanced tools
Middy middleware for adding caching headers to success response and errors
This middleware sets HTTP caching headers, necessary for making the requests cache'able both in browsers and reverse proxies.
Sets headers in after
and onError
phases.
To install this middleware you can use NPM:
npm install --save @schibsted/middy-caching-headers
success
(object) - configuration for the successful requestserrors
(object) - configuration for the error requests based on the statusCodeEvery section of the config contains 3 properties:
directive
(string, optional) - response directive e.g. must-revalidate
, public
etc.clientTime
(int) - time to set max-age
forserverTime
(int) - time to set s-maxage
forSee the sample usage below.
const middy = require('@middy/core');
const cors = require('@schibsted/middy-caching-headers');
const handler = middy(async () => ({
statusCode: 200,
body: JSON.stringify({ foo: 'bar' }),
}));
handler
.use(cors({
success: {
directive: null,
serverTime: 3600,
clientTime: 600,
},
errors: {
default: {
directive: null,
serverTime: 5,
clientTime: 5,
},
502: false,
404: {
directive: null,
serverTime: 600,
clientTime: 600,
},
},
}));
// when Lambda runs the handler...
handler({}, {}, (_, response) => {
expect(response).toEqual({
statusCode: 200,
headers: {
'cache-control': 'max-age=600,s-maxage=3600',
'surrogate-control': 'max-age=3600',
},
body: JSON.stringify({ foo: 'bar' }),
})
})
Everyone is very welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.
4.0.4 (2022-08-29)
FAQs
Middy middleware for adding caching headers to success response and errors
The npm package @schibsted/middy-caching-headers receives a total of 5 weekly downloads. As such, @schibsted/middy-caching-headers popularity was classified as not popular.
We found that @schibsted/middy-caching-headers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.