mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Add function to allow hosts from environment variables (#287)
* Add allowed host option to handle CORS requests * Update readme with new GRIST_ALLOWED_HOSTS environment variable
This commit is contained in:
@@ -14,6 +14,7 @@ import {promisifyAll} from 'bluebird';
|
||||
import * as _ from 'lodash';
|
||||
import fetch from 'node-fetch';
|
||||
import {createClient, Multi, RedisClient} from 'redis';
|
||||
import {matchesBaseDomain} from 'app/server/lib/requestUtils';
|
||||
|
||||
promisifyAll(RedisClient.prototype);
|
||||
|
||||
@@ -550,6 +551,6 @@ export function isUrlAllowed(urlString: string) {
|
||||
}
|
||||
|
||||
return (process.env.ALLOWED_WEBHOOK_DOMAINS || "").split(",").some(domain =>
|
||||
domain && url.host.endsWith(domain)
|
||||
domain && matchesBaseDomain(url.host, domain)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user