With any WAF product, you will want to ensure that network traffic cannot bypass
your WAF and hit your API Gateway directly. Fastly offers several ways to ensure
that your API Gateway is only accessible through the WAF.
The information below is a summary of Fastly's own recommendations for securing
your backend - regardless of whether you are using Zuplo, another API Gateway,
or Fastly origins. You can reference the
Fastly documentation.
Fastly maintains a list of IP addresses that you can use to restrict access to
your API Gateway. This is a good way to ensure that only Fastly can access your
API Gateway. However, as Fastly is a multi-tenant service, this method is not
sufficient to protect unauthorized traffic from hitting your API Gateway.
In Zuplo, you can utilize the IP Address Restriction policy to limit traffic to
only the Fastly IP addresses. You don't need to provide the address list
manually, instead you can utilize the built-in list as shown below.
With this policy in place, only Fastly traffic will be allowed to hit your Zuplo
API Gateway.
Another way to ensure that traffic is coming from Fastly is to use signed
headers. Signed headers can be added using a
VLC Snippet and then
checked by your API Gateway. This provides an additional layer of security on
top of IP address restrictions and prevents any unauthorized traffic from
hitting your API Gateway - regardless of the source.
In Fastly, you will need to create a VCL snippet that adds a signed header as
shown below. This example uses the shared_secret value stored in an
Edge Dictionary.
In Zuplo, you can utilize the a custom code inbound policy to limit traffic to
only those requests that include the signed header.
With this policy in place, only requests that include a valid sign header will
be allowed to hit your Zuplo API Gateway.
Another way to ensure that traffic is coming from Fastly is to use add a JWT
header to the outgoing request. JWT headers can be added using a
VLC Snippet and then
checked by your API Gateway. This provides an additional layer of security on
top of IP address restrictions and prevents any unauthorized traffic from
hitting your API Gateway - regardless of the source.
Tip
This demo shows using a shared secret for generating and verifying the JWT.
However, you could also use public/private keys for this purpose. Additionally,
you could use a third-party identity provider (Auth0, Cognito) to issue machine
to machine tokens.
In Fastly, you will need to create a VCL snippet that adds a JWT header as shown
below. This example uses the shared_secret value stored in an
Edge Dictionary.
To verify the JWT header in Zuplo, you can utilize the JWT Auth Inbound policy.
Fastly supports mTLS authentication for backend services. This is a good way to
ensure that only Fastly can access your API Gateway. For documentation on
configuring Fastly with mTLS, see the
Fastly documentation.
To configure Zuplo to accept mTLS connections, see the
Zuplo mTLS Policy documentation.