A service to proxy a GET requests to a FaaS POST event and parse the response back into HTML content.
Designed to be used with the AWS lambda container and 11ty project.
This is currently not meant to be an internet facing webserver and should be deployed with a caching layer and TLS termination etc.
cargo build --release
If you are just running the demo project https://github.com/No9/eleventy-serverless-docker then the toml file will be fine.
Otherwise review the following settings in knative.toml
[build]
# if you want to publish content you can by pointing to a folder.
publish = "public"
[errorpages]
# Currently only custom 404 and 500 are supported.
not_found = "404.html"
internal_server_error = "500.html"
[[headers]]
# Define which paths this specific [[headers]] block will cover.
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
Content-Security-Policy = "frame-ancestors https://www.facebook.com"
# Multi-value headers are expressed with multi-line strings.
cache-control = '''
max-age=0,
no-cache,
no-store,
must-revalidate'''
[[redirects]]
# this section matches routes to a serverless function.
from = "/:slug/"
to = "http://127.0.0.1:8080/2015-03-31/functions/function/invocations"
If your just taking a look then start an instance of https://github.com/No9/eleventy-serverless-docker#step-3-create-container
Open a web browser at http://localhost:8090/1/ or http://localhost:8090/1/
If you have podman installed then the whole demo can be ran as follows:
-
Clone this repository
git clone https://github.com/No9/faas-content-proxy
-
Create an s3 bucket on your favourite cloud provider.
-
Copy the contents of the folder
sampledata
to the s3 bucket -
Create some credentials for the bucket.
-
Then create a
.env
file in the base folder of this project with the following entries.Replacing the XXXX with the vaules from the credentials you created.
S3ACCESSKEY=XXXX S3SECRET=XXXX S3BUCKETNAME=XXXX S3ENDPOINT=XXXX
-
Run podman script
./runpod.sh
-
Open a web browser at http://localhost:8090/1/ or http://localhost:8090/1/