Nginx reverse-proxy with SSL termination, and a simple cache-invalidation system designed to automate cache invalidation by handling Webflow webhook requests triggered site_publish events
Install Nginx on your server. Nginx was the chosen reverse-proxy solution
sudo yum install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo yum update -y
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel bzip2 readline-devel sqlite sqlite-devel tk-devel xz-devel
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
source ~/.bashrc
pyenv install 3.11.0
pyenv global 3.11.0
# Install Python dependencies
pip install fastapi uvicorn
# Run FastAPI in the background by running the following command from directory where main.py is located
nohup uvicorn main:app --host 0.0.0.0 --port 8000 &
Set up a Webflow webhook for "site_publish" events. The webhook needs to point to the reverse-proxy server at path, /invalidate-cache. The webhook request will be directed to the FastAPI web-server running on the same machine. This web-server will handle that request by invalidating the site's cache by removing cached files from disk.
For HTTPS
sudo yum install certbot python3-certbot-nginx
sudo certbot --nginx -d reverse-proxy.domain.com -d www.reverse-proxy.domain.com