enableCORS

enableCORS

Description

Set this option to true to enable Cross-Origin Resource Sharing (CORS) for all routes in the Profound.js server. Alternatively, set it to an object representing CORS options.

For the full list of supported options, see https://www.npmjs.com/package/cors.

Example 1: Enable CORS for Everything

Allow any origin to call any route. This is convenient during development but permissive for production:

enableCORS: true

Example 2: Restrict CORS

Allow only one origin, only two HTTP methods, and only the two request headers the application actually needs:

enableCORS: { origin: 'https://example.com', methods: ['GET', 'POST'], allowedHeaders: ['Content-Type', 'Authorization'] }

For information on how to modify this setting, see Configuration File.