Saturday, 28 May 2022

Resolving CORS issue using reverse proxy

1. install heroku cli 

2. git clone https://github.com/Rob--W/cors-anywhere.git

https://github.com/Rob--W/cors-anywhere

3. npm install

4. heroku create

Creating app... !
 !    Invalid credentials provided.
heroku: Press any key to open up the browser to login or q to exit:
Opening browser to https://cli-auth.heroku.com/auth/cli/browser/53511e72-3354-44e0-a45e-80e2f5fe5510?requestor=SFMyNTY.g2gDbQAAAA8xMDYuMjEwLjE0Ny4yMTRuBgDIHn0KgQFiAAFRgA.W0AyFZigs1NJHJxkkq0UPACmR12Lc_46TszBnb9i32A
Logging in... done
Logged in as ajab.nagesh@gmail.com
Creating app... done, ⬢ salty-oasis-62166
https://salty-oasis-62166.herokuapp.com/ | https://git.heroku.com/salty-oasis-62166.git

5. git push heroku master

This will create a reverse proxy server

6. Now while making ajax call just put this app url before ur api endpoint 

corsurl+ baseUrl + 'action/insertOne',

 


No comments:

Post a Comment

Search This Blog

Creating your first "Alexa" Skill

Index What is Alexa What is Alexa Skill? Why is it required when Alexa already equipped with voice assistant? Dev...