An open API service indexing awesome lists of open source software.

https://github.com/contextualist/proxlet

a POC, naïve implemetation of serverless reverse proxy for any website
https://github.com/contextualist/proxlet

reverse-proxy serverless

Last synced: 10 months ago
JSON representation

a POC, naïve implemetation of serverless reverse proxy for any website

Awesome Lists containing this project

README

          

# Proxlet

[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/Contextualist/proxlet)

Proxlet is a POC, naïve implemetation of serverless reverse proxy for any website.

## Supported Providers

* [Now.sh](https://zeit.co/now)
* [AWS Lambda](https://aws.amazon.com/lambda)
* [Google Cloud Functions](https://cloud.google.com/functions)

### Now.sh

dev dependency: [now-cli](https://github.com/zeit/now-cli#usage)

```bash
now

curl https://{app_name}.now.sh/https://httpbin.org/get
```

### AWS Lambda

dev dependency: [Serverless Framework](https://serverless.com/framework/docs/getting-started/)

```bash
# First customize serverless.yml's fields: provider.role, provider.region, etc.
make aws

# Then go to AWS API Gateway console, Setting, add Binary Media Type "*/*".
# (All contents are base64-encoded and will be decoded by the API Gateway.)

curl https://{id}.execute-api.{region}.amazonaws.com/dev/https://httpbin.org/get
```

CAVEAT: All subsequent requests fail because of they are lack of the stage path `/dev`

### Google Cloud Functions

dev dependency: [gcloud](https://cloud.google.com/sdk/docs/quickstarts)

```bash
make gcf

curl https://{region}-{project-id}.cloudfunctions.net/proxlet/https://httpbin.org/get
```

CAVEAT: All subsequent requests fail because of they are lack of the function path `/proxlet`

## About the Cookie

To get the real host of subsequent request of relative path, Proxlet sets a session cookie `proxlet-host` with the value of real host. The server does not store the cookie.

## Known Issues

* Cross-site requests are not proxied.
* Now.sh and AWS Lambda have an HTTP response size limit of 6MB. For GCF, it's 10MB.
* AWS Lambda's stage path / GCF's function name path makes all subsequent requests impossible *(unless using a custom domain)*.