ZipCodeAPI CORS Issue

Many users start with ZipCodeAPI and want to test against their local server and immediately hit a snag. They send us questions similar to the following:

  • I am trying to test using this application to see if it will suffice for our needs. I have created an application, but it is only local. When I activate the client side API key it requests a domain. What should I use for local host?
  • I am making distance api call from javascript but getting:”Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at[KEY]/distance.json/06520/06534/mile. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).”
  • I have a question regarding my development environment. Is it possible to allow adding source http://locahost:59999 (or some other port number) to the CORS list to allow me to test in development environment?

ZipCodeAPI CORS Issue and the Solution

CORS is cross-origin resource sharing and helps control what sources are allowed to access resources in an application. Here are the steps to resolve to get everything working:

  • Go to ClientSide Key Setup and enter Application Key and Email
    • ZipCode API ClientSide Key
  • Enter the domains allowed access, including localhost for local testing
    •  ZipCode API Client Side Domains
  • Save and you will have a client side key you can use for those domains.
    • ZipCode API Domain Setup Success

If you have any issues reach out to info @