Skip to content

Home > @opengovsg/validators > UrlValidatorOptions > whitelist

UrlValidatorOptions.whitelist property ​

The list of allowed protocols and hostnames for URL validation. The default whitelist allows only http and https protocols, and does not restrict hostnames.

Signature:

typescript
whitelist?: UrlValidatorWhitelist;

Example ​

{
   protocols: ['http', 'https'],
   hosts: ['example.com']
}