On this page
What this issue is
By default, a browser stops a page on one site (say evil.example) from reading responses from another site (yourshop.com). CORS is the set of HTTP headers that lets you relax that rule on purpose. The key headers are Access-Control-Allow-Origin (who may read) and Access-Control-Allow-Credentials (whether cookies and login sessions are included).
The misconfiguration comes in two forms. First, Access-Control-Allow-Origin: * together with Access-Control-Allow-Credentials: true. Browsers refuse this combination, so your own cross-site requests fail. Second, and worse, code that copies whatever Origin the request sends into the response header while also allowing credentials. That one works, and it lets any website read logged-in data from your visitors.
Why it costs you leads or sales
There are two costs. The first is security: with a reflected origin plus credentials, a malicious page can make a logged-in customer's browser call your endpoints and read the answers, such as order history, addresses or account details. That risks data exposure and trust.
The second is breakage. If you send * with credentials, the browser blocks the response. Your checkout widget, embedded form, or cross-domain API call can fail silently with a console error, and visitors simply do not convert.
- Visitor logged inHas a session cookie for your site
- Opens other siteA page you do not control
- Script calls your APIBrowser attaches the cookie
- Server echoes OriginAllow-Origin copies the caller
- Data readPrivate response exposed
The leak happens in the browser of a visitor who is logged in to your site.
How to check if your site has it
Send a request with a fake Origin and look at the response headers. Use an endpoint that returns private or logged-in data, as well as your main API paths.
curl -s -I https://yourshop.com/api/account \
-H 'Origin: https://evil.example' \
-H 'Cookie: session=YOUR_TEST_SESSION' | grep -i '^access-control'
# Bad: the fake origin is echoed back with credentials
# access-control-allow-origin: https://evil.example
# access-control-allow-credentials: true
# Also check the null origin
curl -s -I https://yourshop.com/api/account -H 'Origin: null' | grep -i '^access-control'- Response shows
Access-Control-Allow-Origin: *on an endpoint that uses cookies - The Allow-Origin value changes to match any Origin you send
Access-Control-Allow-Origin: nullis returned for a null origin- Console error: 'wildcard cannot be used when credentials mode is include'
- A regex allows lookalike domains such as
yourshop.com.evil.example
How to fix it
List the origins that truly need access
Write down each exact origin (scheme, host, port), such as
https://www.yourshop.comandhttps://checkout.yourshop.com.Match the Origin against that list
Use exact string comparison. Avoid loose regex or 'ends with' checks, which let attacker domains through.
Send the header only on a match
If the origin is on the list, return it in
Access-Control-Allow-Origin. If not, send no CORS headers.Add Vary: Origin
This stops caches and CDNs serving one origin's response to another.
Drop credentials where not needed
Only send
Access-Control-Allow-Credentials: truefor endpoints that need cookies. Public endpoints can use*without credentials.
Allowlist in application code (Node/Express example)
Compare the Origin to a fixed array, set headers only on a match, and always add
Vary: Origin. The popularcorspackage accepts anoriginarray andcredentials: true.
Find where the header is added
Search your theme and plugins for
Access-Control-Allow-Origin, or check the REST API filterrest_pre_serve_request. A CORS or headers plugin, or a server rule, may be setting it.Replace with an allowlist
Edit the code or plugin setting to use fixed origins instead of
*or the request Origin.
Check your own apps and proxies
Shopify controls its own storefront headers. If you run a custom app or app proxy that serves data, set the allowlist in that app's code.
Check external APIs you call
Webflow hosting does not let you set custom response headers on pages. Fix the CORS settings on the API or backend your Webflow pages call, such as your own server or a serverless function.
map $http_origin $cors_origin {
default "";
"https://www.yourshop.com" $http_origin;
"https://checkout.yourshop.com" $http_origin;
}
server {
location /api/ {
add_header Vary Origin always;
if ($cors_origin) {
add_header Access-Control-Allow-Origin $cors_origin always;
add_header Access-Control-Allow-Credentials true always;
}
}
}Before
- Allow-Origin echoes any caller
- Credentials allowed for everyone
- No Vary header
After
- Only listed origins get headers
- Credentials only on endpoints that need them
- Vary: Origin on responses
How to confirm it's fixed
Repeat the curl test with a fake origin. You should see no Access-Control-Allow-Origin header at all. Then test with each trusted origin and confirm the header matches it exactly. Finally, load your real pages and check the browser console and Network tab for CORS errors on legitimate calls.
| Origin sent | Expected Allow-Origin | Credentials header |
|---|---|---|
| https://www.yourshop.com | https://www.yourshop.com | true |
| https://evil.example | (none) | (none) |
| null | (none) | (none) |
| https://yourshop.com.evil.example | (none) | (none) |
How to prevent it happening again
- Keep the allowlist in one place in code or config, under version control
- Never copy the request Origin straight into the response
- Do not allow
nullas an origin - Review CORS when adding a new subdomain, app or CDN
- Include a CORS check in security reviews and penetration tests
- Always send
Vary: Originwhen the value depends on the request
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys, such as forms, checkouts and tracking hits, on a schedule. It does not inspect your CORS response headers for security flaws. For this, use a web application security scanner or a penetration test, which probe your endpoints with crafted Origin headers. A CORS error that breaks a form or checkout step would show up as a failed journey, but finding the security flaw itself needs a security tool.
FunnelGuard has a Free plan with 1 site and 2 journeys, and paid plans come with a 3-day free trial.
Questions people ask
Why does Access-Control-Allow-Origin * not work with credentials?
Browsers block it on purpose. When a request includes cookies or other credentials, the response must name one specific origin, not *. The fix is to return the exact trusted origin and Access-Control-Allow-Credentials: true.
Is Access-Control-Allow-Origin * a security risk?
Not always. It is fine for public content that needs no login, such as open fonts or a public API. It is a risk when used on endpoints that return private data, or when paired with code that reflects any origin.
How do I test my site for CORS misconfiguration?
Use curl to send a request with an Origin: https://evil.example header and read the response headers. If your server echoes that origin back, especially with Access-Control-Allow-Credentials: true, it is misconfigured. Also test Origin: null.
What is the safe way to allow multiple origins in CORS?
Keep an allowlist of exact origins and compare the request Origin to it. If it matches, return that origin in the header. Otherwise send no CORS headers. Add Vary: Origin so caches stay correct.
Why is reflecting the Origin header dangerous?
It makes the server trust every website. With credentials allowed, a malicious page can make a logged-in visitor's browser call your site and read the response, exposing private data.
Can FunnelGuard detect CORS misconfiguration?
No. This is outside what FunnelGuard checks. Use a web application security scanner or a penetration test to find CORS flaws. FunnelGuard is built to run customer journeys and tracking checks.
Do I need CORS headers for my own pages?
No, not for same-origin requests. You only need CORS when a page on one origin (including a different subdomain or port) reads responses from another. If nothing cross-origin needs access, send no CORS headers.
Related issues
- OPS-170Missing Content-Security-PolicyFix guide
- OPS-175Cookies without Secure/HttpOnly/SameSiteFix guide
- OPS-176Open redirect on site (abused for phishing, ad disapproval)Fix guide
- OPS-177Reflected XSS in form fields or searchFix guide
- OPS-171Missing X-Frame-Options / frame-ancestors (clickjacking)Fix guide
- OPS-169User enumeration via REST API / author pagesFix guide