mirror of
https://github.com/hexastack/hexabot
synced 2025-02-03 03:25:01 +00:00
fix: include wildcard support
This commit is contained in:
parent
778bd59f91
commit
e7109ba036
@ -317,10 +317,10 @@ export default abstract class BaseWebChannelHandler<
|
|||||||
.some((origin: string) => {
|
.some((origin: string) => {
|
||||||
// If we find a whitelisted origin, send the Access-Control-Allow-Origin header
|
// If we find a whitelisted origin, send the Access-Control-Allow-Origin header
|
||||||
// to greenlight the request.
|
// to greenlight the request.
|
||||||
return origin === req.headers.origin || origin === '*';
|
return origin === req.headers.origin;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!foundOrigin) {
|
if (!foundOrigin && !origins.includes('*')) {
|
||||||
// For HTTP requests, set the Access-Control-Allow-Origin header to '', which the browser will
|
// For HTTP requests, set the Access-Control-Allow-Origin header to '', which the browser will
|
||||||
// interpret as, 'no way Jose.'
|
// interpret as, 'no way Jose.'
|
||||||
res.set('Access-Control-Allow-Origin', '');
|
res.set('Access-Control-Allow-Origin', '');
|
||||||
|
Loading…
Reference in New Issue
Block a user