Wascer
Help Center
Parcourir la documentation

Set up with AWS CloudFront

1 min de lectureView as Markdown


For sites using AWS CloudFront, set up Same-Origin by creating a new origin, behavior, and Lambda@Edge function.

Step 1. Configure the origin

  • In the CloudFront console, open your distribution and go to the Origins tab.
  • Click Create origin.
  • In the Origin domain field, enter your Wascer container domain (for example, sst.yoursite.com.br).
  • Select HTTPS only as the protocol.
  • Add a custom header: name X-From-Cdn, value cft-wascer.
  • Confirm the origin creation.

Step 2. Configure the behavior

  • Go to the Behaviors tab and create a new behavior.
  • Set the Path pattern to /metrics/* (adjust it for your path).
  • Select the origin created in the previous step.
  • Under Viewer protocol policy, select HTTPS only.
  • Save the configuration.

Step 3. Deploy the Lambda@Edge function

  • In the Lambda console, create a new function using the Node.js 22.x runtime.
  • For the execution role, select Create from AWS policy templates and choose Basic Lambda@Edge permissions.
  • Add function code that rewrites the Host header to the origin domain and removes the /metrics prefix from the URI.
  • Deploy the function and, under Actions, select Deploy to Lambda@Edge.
  • Select your distribution, the created behavior, and the Origin request event.
  • Confirm and wait for the deployment.


To verify, open https://yoursite.com.br/metrics in the browser. A 400 error indicates that the proxy is working correctly.

Was this article helpful?

Still stuck? Talk to support.

Comments

Leave a comment

Only your first name and last initial appear on the site; your email stays with us. See the privacy policy.