Detect host from list of allowed urls even if they have http/https
This commit is contained in:
parent
d0ddf018c7
commit
d706ca389f
|
|
@ -1332,7 +1332,11 @@ export class App {
|
|||
if (parsedConfig.allowedOrigins && parsedConfig.allowedOrigins.length > 0 && isValidAllowedOrigins) {
|
||||
const originHeader = req.headers.origin as string
|
||||
const origin = new URL(originHeader).host
|
||||
isDomainAllowed = parsedConfig.allowedOrigins.includes(origin)
|
||||
isDomainAllowed =
|
||||
parsedConfig.allowedOrigins.filter((domain: string) => {
|
||||
const allowedOrigin = new URL(domain).host
|
||||
return origin === allowedOrigin
|
||||
}).length > 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,10 +145,7 @@ const AllowedDomainsDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
|
|||
flexDirection: 'column'
|
||||
}}
|
||||
>
|
||||
<span>
|
||||
Your chatbot will only work when used from the following domains. When adding domains, exclude the{' '}
|
||||
<pre style={{ display: 'inline' }}>http://</pre> or <pre style={{ display: 'inline' }}>https://</pre> part.
|
||||
</span>
|
||||
<span>Your chatbot will only work when used from the following domains.</span>
|
||||
</div>
|
||||
<Box sx={{ '& > :not(style)': { m: 1 }, pt: 2 }}>
|
||||
<List>
|
||||
|
|
|
|||
Loading…
Reference in New Issue