This repository contains a Go reverse proxy for frontend assets. It acts as the main entrypoint for frontend applications, serving assets from an S3‑compatible object storage backend (AWS S3 or MinIO) and applying SPA‑friendly routing.
This component is part of an initiative to implement an object storage-based push cache, allowing historical and current frontend assets to be accessed and managed in an aggregated fashion.
Key functionalities include:
- Reverse proxying requests to S3/Minio.
- Supporting Single Page Application (SPA) routing by ensuring that requests for non-existent asset paths correctly serve the main application entrypoint (e.g.,
index.html). - Providing a flexible point for potential future processing of asset requests.
- Designed to be deployed as a containerized application, managed by a Frontend Operator (FEO) within a Kubernetes environment (e.g., in the FEO namespace as a new managed resource).
- Built and versioned using Konflux.
- Go HTTP server using AWS SDK v2 (S3 GetObject streaming)
- Containerized for consistent deployments
- Configurable via environment variables
/healthzendpoint for health checks
| Variable | Description | Example | Default |
|---|---|---|---|
SERVER_PORT |
Port the proxy listens on | 8080 |
8080 |
MINIO_UPSTREAM_URL |
S3/MinIO endpoint (scheme+host[:port]) | http://minio:9000 |
(empty = AWS) |
BUCKET_PATH_PREFIX |
Bucket/prefix to prepend (first segment is treated as bucket) | /frontend-assets |
— |
SPA_ENTRYPOINT_PATH |
SPA entrypoint path for 403/404 fallback | /index.html |
/index.html |
AWS_REGION |
AWS region (used when talking to AWS) | us-east-1 |
us-east-1 |
AWS_ACCESS_KEY_ID |
Access key (optional; for MinIO/local or explicit creds) | minioadmin |
— |
AWS_SECRET_ACCESS_KEY |
Secret key (optional; for MinIO/local or explicit creds) | minioadmin |
— |
AWS_CA_BUNDLE |
(Optional) Path to custom CA bundle for TLS verification | /etc/pki/ca-trust/…/ca.crt |
— |
LOG_LEVEL |
Log level for proxy and SDK (debug, info, warn, error) | debug |
error |
cmd/proxy: Go entrypoint for the reverse proxyinternal/s3: S3 client and proxy logicinternal/logger: Structured logging and request‑scoped AWS SDK loggerDockerfile: Container image builddocker-compose.yml: Local setup (MinIO + proxy)Makefile: Convenience commands (supports docker-compose or podman-compose)test_proxy.sh: Basic curl tests against the proxy
The Makefile simplifies starting, testing, and stopping the local environment.
Prerequisites:
- Docker or Podman
- docker-compose or podman-compose
make- Bash Shell (for
test_proxy.sh) - Git (to clone the repository)
Steps:
-
Clone the Repository (if you haven't already):
git clone [URL_OF_THIS_REPOSITORY] cd frontend-asset-proxy -
Ensure Test Script is Executable (one-time setup):
chmod +x test_proxy.sh
-
Run Tests (This command handles setup and execution):
make testThis command will:
- Start MinIO and the Go proxy in the background using
make up. - Prompt you to set up Minio. This is crucial for the first run or if Minio data was cleared (
make clean-all).- Go to the Minio Console:
http://localhost:9001 - Log in:
minioadmin/minioadmin - Create bucket:
frontend-assets - Set
frontend-assetsbucket "Access Policy" to "Public". - Upload necessary test files to the
frontend-assetsbucket:index.html(to the root of the bucket)edge-navigation.json(to the pathapi/chrome-service/v1/static/stable/prod/navigation/within the bucket)
- Go to the Minio Console:
- After setting up Minio, press Enter in the terminal where
make testis waiting. - The
./test_proxy.shscript will then execute.
- Start MinIO and the Go proxy in the background using
-
Review Test Output: The script will indicate if tests passed or failed.
-
View Logs (for debugging if tests fail):
- All services:
make logs - Proxy only:
make proxy-logs - MinIO only:
make minio-logs(PressCtrl+Cto stop following logs).
- All services:
-
Stop Services: When you're done:
make down
Other Useful Makefile Commands:
make help: Shows all available commands and their descriptions.make up: Starts services without running tests or prompting for Minio setup.make build: Rebuilds the Go proxy image.make clean: Stops and removes containers and networks.make clean-all: Stops and removes containers, networks, AND the Minio data volume (this will delete your Minio bucket and files, requiring Minio setup again).
If you prefer not to use make or need to perform steps individually, refer to the docker-compose.yml and test_proxy.sh script. You would typically:
- Start services with
docker-compose up -d(orpodman-compose up -d). - Configure MinIO as described above.
- Run
chmod +x test_proxy.sh && ./test_proxy.sh. - Stop services with
docker-compose down.
This component is designed to be deployed by the Frontend Operator (FEO). The container image will be built by Konflux and made available in the organization's container registry.
Refer to the FEO documentation for specific deployment procedures and how it manages this resource.