https://github.com/mikewesthad/node-proxy-server
https://github.com/mikewesthad/node-proxy-server
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mikewesthad/node-proxy-server
- Owner: mikewesthad
- Created: 2016-06-22T23:55:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-05-01T18:39:02.000Z (over 6 years ago)
- Last Synced: 2025-02-14T08:46:27.753Z (11 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Node Proxy Server
=================
A node app that proxies GET requests, with CORS support. I was dealing with some APIs that don't serve over HTTPS and I needed a proxy in order to access them over HTTPS.
The app expects a query parameter, `url`, which contains the [URI encoded](http://www.w3schools.com/tags/ref_urlencode.asp) URL that is being proxied. Assuming that the app is hosted at https://www.demo-url.com, you can use it like this to request the page for www.google.com:
```
https://www.demo-url.com?url=http%3A%2F%2Fwww.google.com
```
Or if you are talking to the Google location API and asking for a JSON file via https://maps.googleapis.com/maps/api/geocode/json?address=Chicago:
```
https://www.demo-url.com?url=https%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fgeocode%2Fjson%3Faddress%3DChicago
```
The CORS options are set [here](https://github.com/mikewesthad/api-https-to-http-forwarding/blob/master/app.js#L10). See the cors node package [documentation](https://github.com/expressjs/cors#configuration-options) for how to change the whitelisted domains.