# The Odds API support for CORS
The Odds API supports Cross-Origin Resource Sharing (CORS) from any origin.
CORS requires HTTP or HTTPS as the origin URL schemes. Many browsers will block CORS if the request originates from a local file instead of a web server. For example, CORS will be blocked if the source URL starts with file://, such as file://index.html. More information can be found here (opens new window).
To avoid CORS issues when developing locally, set up a local web server instead of opening HTML files directly from the file system.
# Example Local Web Server Setup
As an example, http-server (opens new window) is a popular local web server that can be installed with npm and set up as follows
- Install:
npm install -g http-server
- Navigate to the project directory:
cd /path/to/your/project
- Start the local web server:
http-server
- Access files via HTTP
Open your browser and go to http://localhost:8080 (or replace the port with that specified by http-server).
When serving files through a local web server, the origin will be http://localhost instead of file://, which will prevent CORS issues.