1.0.1 • Published 6 years ago

prokure-cookie-proxy v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

cookieProxy

Browsers genrally do not send cookies across hosts. This helps route the browser requests via the UI server, thereby retaining cookies.

tl;dr Fuck HAProxy

Installing

Decide a route through which you want to forward browser requests, say '/forward'

Server

In your server.js

import requestHandler from "prokure-cookie-proxy"
.
.
app.get('/forward', requestHandler)
app.post('/forward', requestHandler)

Client

Hardcode cookie data if not preset document.cookie = "SN=123; domain=localhost";

Reroute api requests:

const  url = 'https://prokure.it/api/web/address'
const proxyUrl = `/forward?url=${encodeURIComponent(url)}`

NOTE: Make sure that cookies are sent with your fetch request

credentials: "include"

Authors

rushabh anand is awesome

Contributing

Build after making changes

npm run build
npm run publish