0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 16:38:38 +00:00
This commit is contained in:
David Bolack
2026-03-19 19:35:05 -05:00
parent fe0f0c56af
commit a1d56fe5d3
3 changed files with 31 additions and 20 deletions
+7 -3
View File
@@ -80,15 +80,19 @@ export default async function createApp(vite) {
const herokuRegex = /^https:\/\/(?:homebrewery-pr-\d+\.herokuapp\.com|naturalcrit-pr-\d+\.herokuapp\.com)$/; // Matches any Heroku app
console.log( 'IsLocalEnvironment');
console.log(isLocalEnvironment);
console.log('localNetworkRegex');
console.log(localNetworkRegex.test(origin));
console.log(origin == 'null');
console.log('origin');
console.log(origin === 'null');
console.log(origin);
if(!origin | origin == 'null' || allowedOrigins.includes(origin) || herokuRegex.test(origin) || (isLocalEnvironment && localNetworkRegex.test(origin))) {
if(!origin || origin === 'null' || allowedOrigins.includes(origin) || herokuRegex.test(origin) || (isLocalEnvironment && localNetworkRegex.test(origin))) {
callback(null, true);
} else {
console.log(origin, 'not allowed');
callback(new Error('Not allowed by CORS, if you think this is an error, please contact us'));
callback(new Error('Not allowed by CORS, if you think this is an error, please contact us - Skidoosh'));
}
},
methods : ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],