Skip to content

API

Corsfix provides two methods to proxy your requests, giving you flexibility in how you interact with the CORS Proxy.

Method 1: Direct URL Path

The simplest way to use the proxy is by appending the target URL directly to the path:

https://proxy.corsfix.com/?https://api.example.com/data

Example Usage

fetch("https://proxy.corsfix.com/?https://api.example.com/data")
.then((response) => response.json())
.then((data) => console.log(data));

Method 2: URL Parameter

You can also use the url parameter to specify your target:

https://proxy.corsfix.com/?url=https://api.example.com/data

Example Usage

fetch("https://proxy.corsfix.com/?url=https://api.example.com/data")
.then((response) => response.json())
.then((data) => console.log(data));

Request Headers

The Origin header must be included with each request. This header is used by Corsfix to validate if your application is authorized to use the CORS proxy. Browsers automatically set this header when making requests using APIs like fetch.

Response Headers

The proxy automatically adds the following CORS header to the responses:

Access-Control-Allow-Origin: <your-request-origin>

Timeouts

When a request takes longer than 20 seconds to complete, the proxy will return a 504 Gateway Timeout response. This status code indicates that the server did not receive a timely response from the target server.