https://github.com/raybb/cors-with-cookies
Sometimes you just need a little cookies with your CORs
https://github.com/raybb/cors-with-cookies
Last synced: 2 months ago
JSON representation
Sometimes you just need a little cookies with your CORs
- Host: GitHub
- URL: https://github.com/raybb/cors-with-cookies
- Owner: RayBB
- Created: 2024-11-29T17:38:36.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-29T18:57:28.000Z (6 months ago)
- Last Synced: 2025-01-29T18:28:29.932Z (4 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CORS Proxy with Cookie Support
A simple Express-based proxy server that handles CORS requests while preserving cookies. Perfect for situations where you need to make cross-origin requests that require cookie preservation.
## Features
- Handles CORS requests with cookie support
- Forwards all HTTP methods
- Preserves headers and cookies
- Simple JSON-based request format
- Error handling and validation## Installation
```bash
npm install
```## Usage
1. Start the server:
```bash
npm start
```2. Make requests to the proxy:
```javascript
fetch('http://localhost:3000/proxy', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://api.example.com/data',
method: 'GET',
headers: {
'Accept': 'application/json'
},
body: {} // Optional request body
})
})
```## API
### POST /proxy
Request body format:
```json
{
"url": "Required: Target URL",
"method": "Required: HTTP method (GET, POST, etc.)",
"headers": {
"Optional": "Request headers"
},
"body": "Optional: Request body data"
}
```## Testing
Run the included test script:
```bash
npm test
```