Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
strapi-cdn-url-rewrite
Advanced tools
Strapi controller module to rewrite upload URLs to CDN. Swaps out your bucket URLs for your CDN URLs in your response data.
yarn add strapi-cdn-url-rewrite
Add your storage and CDN endpoints to your .env
file like so:
STORAGE_ENDPOINT=https://your-bucket.storage.com
CDN_ENDPOINT=https://your-bucket.cdn.com
(You can also pass them directly if you don't want to use environmental variables. See below.)
Open your collection or single type's controller file (eg., ./api/{COLLECTION}/controllers/${COLLECTION}.js
), and add the following, substituting your collection or single type's name in the place of {COLLECTION}
:
const StrapiCdnUrlRewrite = require('strapi-cdn-url-rewrite')
const { cdn } = new StrapiCdnUrlRewrite()
module.exports = {
async find(ctx) {
return cdn(await strapi.services.{COLLECTION}.find())
},
async findOne(ctx) {
return cdn(await strapi.services.{COLLECTION}.findOne())
}
}
const { cdn } = StrapiCdnUrlRewrite(storageUrl, cdnUrl)
storageUrl
Valid URL string to your storage bucket. Eg., https://your-bucket.s3.wasabisys.com
.
cdnUrl
Valid URL string for your CDN endpoint Eg., https://your-bucket.b-cdn.com
.
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator
FAQs
Strapi controller module to rewrite upload URLs to CDN
The npm package strapi-cdn-url-rewrite receives a total of 8 weekly downloads. As such, strapi-cdn-url-rewrite popularity was classified as not popular.
We found that strapi-cdn-url-rewrite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.