Skip to content

Commit

Permalink
docs(readme): update example (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored May 29, 2022
1 parent 7b1ee06 commit 0c6c8b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ const fastify = require('fastify')()
fastify.register(require('@fastify/cors'), (instance) => {
return (req, callback) => {
const corsOptions = {
// This is NOT recommended for production as it enables reflection exploits
origin: true
};
// do not include CORS headers for requests from localhost
if (/localhost/.test(req.headers.origin)) {
if (/^localhost$/m.test(req.headers.origin)) {
corsOptions.origin = false
}
Expand Down

0 comments on commit 0c6c8b2

Please sign in to comment.