Skip to content

Commit

Permalink
Merge pull request #52 from andresavic/master
Browse files Browse the repository at this point in the history
Adding CORS compatibility for Ionic capacitorjs
  • Loading branch information
StorytellerCZ authored Nov 12, 2023
2 parents 6a66b71 + 3789e5b commit 2a4adc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions timesync-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ WebApp.rawConnectHandlers.use(url.pathname,
// and http://meteor.local for earlier versions
const origin = req.headers.origin;

if (origin && ( origin === 'http://meteor.local' ||
origin === 'meteor://desktop' ||
if (origin && ( origin === 'http://meteor.local' ||
origin === 'capacitor://meteor.local' ||
origin === 'meteor://desktop' ||
/^http:\/\/localhost:1[23]\d\d\d$/.test(origin) ) ) {
res.setHeader('Access-Control-Allow-Origin', origin);
}
Expand Down

0 comments on commit 2a4adc6

Please sign in to comment.