Skip to content

* Multiple Image Bug Is fixed | A simple proxy to load CORS blocked image - NPM module

Notifications You must be signed in to change notification settings

mjhatami/pass-cors

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pass-cors

A simple proxy to load CORS blocked files

Must be used in an express server environment

$ npm i pass-cors

  • Can be Used with any file type
  • Just two lines of integration
  • Eliminate third party proxy server dependency
  • No need of a separate server to be hosted just for proxy
  • This will function as a part of your current server and opens up a custom path set by the user


Server Side

//Boilerplate
const express = require('express')
const app = express()


//Main
const proxy = require('pass-cors')
app.use('/proxy', proxy);  //You can customise the route name


//Boilerplate
app.listen(process.env.PORT||8080)


Client Side


Before

<img src="https://corsblockedimage.com/cat.png">

<script src="https://corsblockedscript.com/sometool.js"></script>

<link href="https://corsblockedcss.com/style.css" rel="stylesheet">

After

<img src="/proxy?url=https://corsblockedimage.com/cat.png">

<script src="/proxy?url=https://corsblockedscript.com/sometool.js"></script>

<link href="/proxy?url=https://corsblockedcss.com/style.css" rel="stylesheet">

Thats how easy it is to load a CORS blocked elements on your frontend

About

* Multiple Image Bug Is fixed | A simple proxy to load CORS blocked image - NPM module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%