The Simplest Way to Make Akamai Edgeworkers and Caddy Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using akamai edgeworkers and caddy lets teams run edge logic before origin servers get traffic. Edge scripts filter user requests first, and the origin web server handles TLS and app routing. This pair speeds up web apps and reduces load on backend servers. Edge scripts rewrite headers, check user tokens, and route traffic closer to users. Then the origin server manages local certs and forwards clean traffic to internal apps. Teams get fast responses at the edge and simple setup at the origin.

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Using akamai edgeworkers and caddy lets teams run edge logic before origin servers get traffic. Edge scripts filter user requests first, and the origin web server handles TLS and app routing.

This pair speeds up web apps and reduces load on backend servers. Edge scripts rewrite headers, check user tokens, and route traffic closer to users. Then the origin server manages local certs and forwards clean traffic to internal apps. Teams get fast responses at the edge and simple setup at the origin.

How akamai edgeworkers and caddy handle requests and keys

Data flows from the user to the edge network first. An edge script runs custom JavaScript to check the request and add headers. Next, the edge node sends the safe request over the internet to the origin server. The origin server reads the headers and sends traffic to the right local service.

Both tools must trust each other to keep data safe in transit. Teams set up mutual TLS or shared secret headers between the edge and origin. The edge script attaches a secret key or client cert to every outbound call. The origin server checks this cert or key before it accepts the request.

Permissions stay split between the two layers. Edge scripts only hold keys needed to check user sessions or sign origin requests. The origin server holds local certs and talks to internal backend services. Neither tool needs full access to the whole stack.

Common failure modes and how to scope network paths

Many teams make mistakes when they link edge scripts to origin servers. A common failure mode is using one shared static key across all edge scripts. If a bad actor steals that key, they can send fake requests to the origin. Another risk is leaving the origin server open to the public web. Attackers can skip the edge rules and hit the origin IP address right away.

Unlogged requests and broad permissions also hurt security. Teams often give edge scripts broad tokens that can read all backend routes. When an incident happens, ops teams lack clear logs linking edge events to origin hits. Sensitive fields like emails or phone numbers might also leak into plain text logs.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these gaps with strict network rules and scoped roles. First, lock down the origin firewall so it only accepts edge IP ranges. Second, use mutual TLS instead of static header keys to check edge requests. Give each edge script a unique role with access to only one origin route.

Rotate origin certs and edge secrets on a set schedule. Set up log rules to rewrite emails, card numbers, and national IDs in results. Link request IDs across both tools so your team can trace every call.

Keeping origin servers and edge scripts in sync

Running two routing layers means your team must keep rules in sync. When developers add a new app route, both tools need updates. If an edge script sends a header the origin drops, the app breaks. Teams should store routing rules in version control and test them together.

Start by writing clear rules for what each layer owns. Let the edge handle geo routing, bot checks, and early token checks. Let the origin web server handle local TLS certs, load balancing, and app logs. Clear boundaries stop teams from writing the same rule twice in two places.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How do we stop users from skipping the edge and hitting the origin?

Block all public traffic at your origin firewall except known edge IP ranges. Require mutual TLS so the origin checks a valid client cert on every request.

Where should we check user login tokens in this setup?

Check user session tokens at the edge first to drop bad traffic early. Then pass a signed header to the origin so internal apps know the user.

How can we keep sensitive user data out of edge and origin logs?

Set up log filters on both tools to rewrite matched fields in results. Mask fields like emails, phone numbers, card numbers, and national IDs before saving logs.

The query runs. The emails stay hidden.