Skip to content

A simple Node.js-based CORS Proxy Server to bypass CORS restrictions and fetch data from external URLs.

License

Notifications You must be signed in to change notification settings

AsifKamboh-COM/cors-proxy-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

62 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Version
Maintained YES
Ask Me Anything !

πŸ“Œ CORS Proxy Server

CORS Proxy Server

CORS Proxy Server is a simple and efficient proxy server built with Node.js and Express.js to fetch headers and HTML content from any URL, bypassing CORS restrictions. It comes with a user-friendly front-end interface. Live Demo

✨ Features

  • Handles CORS (Cross-Origin Resource Sharing) requests
  • Fetch headers and HTML content from any URL
  • Simple UI built with Tailwind CSS
  • Deployable on Vercel, Render, and other platforms
  • Improved error handling and redirection support

πŸ“‚ Repository Structure

/cors-proxy-server
β”‚-- public/
β”‚   └── index.html  # Frontend UI
β”‚-- server.js       # Node.js backend server
β”‚-- package.json    # Dependencies and scripts
β”‚-- vercel.json     # Vercel deployment configuration
β”‚-- README.md       # Documentation
β”‚-- LICENSE         # License

Install Installation

πŸ”Ή Prerequisites

  • Node.js (v16 or higher)
  • Yarn or NPM

πŸ”Ή Clone the Repository

git clone https://github.com/AsifKamboh-COM/cors-proxy-server.git
cd cors-proxy-server

πŸ”Ή Install Dependencies

Using Yarn:

yarn install

Using NPM:

npm install

πŸ”Ή Start the Server

yarn start

or

npm start

Easy to Use Usage

Once the server is running, you can use the proxy by making a request to:

http://localhost:3000/proxy?url=<TARGET_URL>

Example:

http://localhost:3000/proxy?url=https://example.com

This will return:

  • Response status (e.g., HTTP/2 200 OK)
  • Response headers (all headers from the target URL)
  • Full HTML content of the requested page

Deployed Deployment

πŸ”Ή Deploy on Vercel

To deploy this CORS Proxy Server on Vercel, follow these steps:

  1. Fork or clone the repository.

  2. Install Vercel CLI if not already installed:

    npm install -g vercel
  3. Login to Vercel:

    vercel login
  4. Navigate to the project directory and deploy:

    vercel

    Follow the instructions to complete the deployment.

πŸ”Ή Deploy on Render

  1. Push your code to GitHub
  2. Create a new Web Service on Render
  3. Connect your GitHub repository
  4. Set the build command:
    yarn install
  5. Set the start command:
    yarn start
  6. Deploy and get your Render URL!

ENV Optional Environment Variables (Optional)

You can configure the following environment variables:

  • PORT (default: 3000)

Error Handling Error Handling

If you get the error:

{
  "status": "Failed to fetch URL",
  "error": "Invalid URL"
}

Fixed Possible Fixes:

  • Make sure the target URL is publicly accessible.
  • If the request is blocked due to CORS, try using different headers.
  • Some sites have anti-bot protections, which may cause failures.

License: MIT License

This project is licensed under the MIT License.

Built & Maintained By Built & Maintained By

Asif Kamboh – Developer & Open-Source Contributor

About

A simple Node.js-based CORS Proxy Server to bypass CORS restrictions and fetch data from external URLs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published