🐛 (cors) Fix cors setting when bot is origin-restricted
This commit is contained in:
@@ -55,7 +55,11 @@ export const continueChat = publicProcedure
|
|||||||
) {
|
) {
|
||||||
if (origin && session.state.allowedOrigins.includes(origin))
|
if (origin && session.state.allowedOrigins.includes(origin))
|
||||||
res.setHeader('Access-Control-Allow-Origin', origin)
|
res.setHeader('Access-Control-Allow-Origin', origin)
|
||||||
else res.removeHeader('Access-Control-Allow-Origin')
|
else
|
||||||
|
res.setHeader(
|
||||||
|
'Access-Control-Allow-Origin',
|
||||||
|
session.state.allowedOrigins[0]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -59,7 +59,11 @@ export const startChat = publicProcedure
|
|||||||
) {
|
) {
|
||||||
if (origin && newSessionState.allowedOrigins.includes(origin))
|
if (origin && newSessionState.allowedOrigins.includes(origin))
|
||||||
res.setHeader('Access-Control-Allow-Origin', origin)
|
res.setHeader('Access-Control-Allow-Origin', origin)
|
||||||
else res.removeHeader('Access-Control-Allow-Origin')
|
else
|
||||||
|
res.setHeader(
|
||||||
|
'Access-Control-Allow-Origin',
|
||||||
|
newSessionState.allowedOrigins[0]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const session = isOnlyRegistering
|
const session = isOnlyRegistering
|
||||||
|
|||||||
Reference in New Issue
Block a user