A capability URL HTTP server that allows creating secure, transformed request forwarding.
- Create capability URLs that forward requests to destination URLs
- Transform requests using custom JavaScript functions
- Secure access through randomly generated capability IDs
POST to /create-capability
with a JSON body containing:
destinationUrl
: The URL where requests should be forwardedtransformFunction
: A JavaScript function that transforms the request
Example:
{
"destinationUrl": "https://api.example.com/data",
"transformFunction": "function(req) { return { headers: { 'X-Custom': 'value' }, body: req.body }; }"
}
The server will return a capability URL. When requests are made to this URL, they will be:
- Transformed using your provided function
- Forwarded to the destination URL
- Responses will be returned to the original requester
Simply make HTTP requests to the generated capability URL. The server will:
- Transform the request using your function
- Forward it to the destination
- Return the response
Each capability URL contains a unique, random identifier. Only requests with valid capability IDs will be processed.
- Install dependencies:
npm install
- Set up PostgreSQL database:
# Create database (run this once)
createdb capricorn
# If you get permissions errors:
# sudo -u postgres createdb capricorn
- Set environment variables:
- Create
.env
file with:
DATABASE_URL=postgres://localhost:5432/capricorn
- Start the server:
npm start