Skip to main content

Content Security Policy Setup

Hydrogen ships with a strict Content Security Policy. Without whitelisting Glood’s domains, the browser blocks both recommendation fetches and pixel events with CSP violations. This page shows the required configuration.

Required CSP Configuration

Add the Glood domains to the connectSrc directive in your app/entry.server file. Hydrogen merges your entries with its defaults, so localhost/HMR entries are preserved in development:
Only add the origins for the apps you register. Recommendations needs storefront.glood.ai; search needs search.glsvces.com (it serves both the API and events). Registering .use(search()) without the search origin blocks every search fetch and event with a CSP violation.

Glood Domains Explained

Required Endpoints

https://events.glood.ai is no longer used. As of v3, events go to the versioned events API on the main host (POST https://storefront.glood.ai/api/storefront/v3/headless/events). For a version: 2 client, events go to POST https://storefront.glood.ai/api/storefront/event — still on the main host. The single storefront.glood.ai entry covers all cases.

Why This Domain Is Needed

  • Session Init: On load, v3 clients bootstrap a session via POST /api/storefront/v3/headless/init
  • Recommendation Fetches: Sections and recommendations are fetched via fetch() API calls
  • Event Transmission: The SDK sends analytics and attribution events via fetch() to the versioned events API
  • Privacy Compliance: Events are only sent when customer consent is granted
  • Personalization: Allows Glood to provide personalized recommendations

Implementation in Hydrogen

Add the CSP configuration to your root layout file:
If you use a non-default recommendations endpoint, add that host to connectSrc instead of (or alongside) storefront.glood.ai.

Troubleshooting

CSP violations show up in the browser console:
If you see this, the Glood host is missing from connectSrc — add 'https://storefront.glood.ai' for recommendations, or 'https://search.glood.ai' for search (or your custom endpoints). With debug: true on the client, successful transmission logs the target URL, so you can confirm the request reaches the network rather than being blocked.

See Also