Skip to content

Commit

Permalink
Allow CORS
Browse files Browse the repository at this point in the history
I ran into issue beakerbrowser#118 , here is a PR that I think will address the issue, for your consideration.
  • Loading branch information
DougAnderson444 authored Aug 15, 2019
1 parent 2dc6734 commit 26075c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ module.exports = async function (config) {

// Then apply csurf
app.use(config.csrf ? csurf({cookie: true}) : fakeCSRF)

// add CORS to address https://github.com/beakerbrowser/hashbase/issues/118
// for non-beaker CORS access to /.well-known/psa, etc.
app.use(function(req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*") // for CORS access to /.well-known/psa
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
next();
});

// service apis
// =
Expand Down

0 comments on commit 26075c2

Please sign in to comment.