Fix RefererNotAllowedMapError on Google Maps
Your key works — Google simply doesn’t trust the address the request came from. This is the single most common cause of a map that renders on your dev machine and fails in production.
How to tell this is your problem
- The map area loads grey with the “Oops!” overlay.
- Console shows RefererNotAllowedMapError plus the exact referrer Google saw.
- The map works on one host (www) and not the other (bare domain), or works locally and not live.
Why it happens
HTTP referrer restrictions on the API key are an allow-list. Anything not matched — a bare domain, a staging subdomain, a preview URL from your host — is rejected before a single tile is served.
The fix, step by step
- 01Copy the referrer Google reported in the console error; that string is what must be matched.
- 02In Cloud Console open APIs & Services → Credentials and select the key your page uses.
- 03Under Application restrictions → Websites, add both yourwebsite.com/* and *.yourwebsite.com/*.
- 04Add any staging, preview or CDN hosts that also serve the page.
- 05Save and wait up to five minutes for propagation before re-testing.
Confirm it is fixed
Re-run the scan from a clean session. A pass means every maps.googleapis.com request returns 200 and the console is silent.
Check whether this is your error
A scan tells you in about twelve seconds, from a clean session.