mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 07:00:49 +03:00
Fixing comments from PR
This commit is contained in:
@@ -24,8 +24,22 @@ export function getAllowedCorsOrigins(): string {
|
||||
return process.env.CORS_ORIGINS ?? '*'
|
||||
}
|
||||
|
||||
export function getAllowedEmbeddingOrigins(): string {
|
||||
export function getCorsOptions(): any {
|
||||
const corsOptions = {
|
||||
origin: function (origin: string | undefined, callback: (err: Error | null, allow?: boolean) => void) {
|
||||
const allowedOrigins = getAllowedCorsOrigins()
|
||||
if (!origin || allowedOrigins == '*' || allowedOrigins.indexOf(origin) !== -1) {
|
||||
callback(null, true)
|
||||
} else {
|
||||
callback(new Error('Not allowed by CORS'))
|
||||
}
|
||||
}
|
||||
}
|
||||
return corsOptions
|
||||
}
|
||||
|
||||
export function getAllowedIframeOrigins(): string {
|
||||
// Expects FQDN separated by commas, otherwise nothing or * for all.
|
||||
// Also CSP allowed values: self or none
|
||||
return process.env.EMBEDDING_ORIGINS ?? '*'
|
||||
return process.env.IFRAME_ORIGINS ?? '*'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user