yonycalsin / nextjs-cors Goto Github PK
View Code? Open in Web Editor NEW:tada: nextjs-cors is a node.js package to provide a Connect/Express middleware that can be used to enable CORS with various options :rocket:
License: MIT License
:tada: nextjs-cors is a node.js package to provide a Connect/Express middleware that can be used to enable CORS with various options :rocket:
License: MIT License
Hi there.
Nextjs 11 came out.
Could you please add peer dependency support for the latest version.
Thanks in advance.
Is your feature request related to a problem? Please describe.
Next.js updated to version 12.
Describe the solution you'd like
This package to support Next.js 12. I currently get warning messages when using Next.js 12:
[email protected]" has incorrect peer dependency "next@^8.1.1-canary.54 || ^9.0.0 || ^10.0.0 || ^11.0.0".
Describe the bug
Not able to import types for typescript.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Types should be loaded in vscode automatically.
Desktop (please complete the following information):
I tried setting cors whitelist but it didn't work.
var whitelist = ['http://example1.com', 'http://example2.com']
var corsOptions = {
origin: function (origin, callback) {
console.log(origin)
// get undefined
if (whitelist.indexOf(origin) !== -1) {
callback(null, true)
} else {
callback(new Error('Not allowed by CORS'))
}
}
}
Can I use this library for App Router api route handlers?
I see from the example that I can enable cors for that specific route - api/whoami
but is there a way to apply this to all routes?
The latest push to master to update peer dependencies has not been put in to a release yet.
It appears as though it all works fine, are we able to push a patch allowing this to be merged? It's currently causing problems with updating to next 14 in my project
Next.js 13 is out and nextjs-cors depends on nextjs 12:
Could not resolve dependency:
npm ERR! peer next@"^8.1.1-canary.54 || ^9.0.0 || ^10.0.0-0 || ^11.0.0 || ^12.0.0" from [email protected]
In official CORS package documentation I see that an array of domains can be passed as origin
value: https://github.com/expressjs/cors#configuration-options
Passing an array to origin
seems not to be working with the current version of this package.
To Reproduce
Working example:
await NextCors(req, res, {
origin: "*",
});
Not working example:
await NextCors(req, res, {
origin: ["*"],
});
master
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here are some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
An npm token must be created and set in the NPM_TOKEN
environment variable on your CI environment.
Please make sure to create an npm token and to set it in the NPM_TOKEN
environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/
.
Good luck with your project ✨
Your semantic-release bot 📦🚀
Is there an example where Axios, Next-cors is used together?
I am developing app with next js version 10
we get call back from different domain for fetching data .
On developing mode things work but on production callback don't seem to work.
I believe it as cors issue
Hi @yonycalsin could we get a package release for v.1.0.5 with the latest changes? Thanks 😃
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.