Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Allow CORS #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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