Add logging to allowed domains checks

This commit is contained in:
Ilango 2024-02-27 09:44:31 +05:30
parent dd0862b6e1
commit ce16fd94f9
1 changed files with 2 additions and 0 deletions

View File

@ -1224,8 +1224,10 @@ export class App {
})
if (!chatflow) return res.status(404).send(`Chatflow ${req.params.id} not found`)
let isDomainAllowed = true
logger.debug(`[server]: Request originated from ${req.headers.host}`)
if (chatflow.chatbotConfig) {
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
logger.debug(`[server]: Chatflow ${req.params.id} has config ${chatflow.chatbotConfig}`)
if (parsedConfig.allowedDomains && parsedConfig.allowedDomains.length > 0) {
isDomainAllowed = parsedConfig.allowedDomains.includes(req.headers.host)
}