The proxy

Install the proxy

The proxy runs as one more container. As a sidecar it shares each replica of your site, so it scales with it; as its own container it sits in front of your site. Choose where your site runs.

Before you start, have your site key from Sites, and know the port your site listens on. The examples use 3000.

Visitorbrowser or bot
Container Apps ingress (HTTPS)
One replica of your container appAwenen proxyvisitors on :8080status on :8081, privateYour sitelocalhost:3000:8080localhostevents and a heartbeat, in the backgroundingest.awenen.com
  1. Store your key as a secret

    Keep the key out of the app’s plain settings. Replace the names with your app and resource group.

    Terminal
    az containerapp secret set --name my-site --resource-group my-rg \  --secrets awenen-key=awn_…
  2. Export the app's definition

    Terminal
    az containerapp show --name my-site --resource-group my-rg --output yaml > my-site.yaml
  3. Add the proxy beside your container

    Under template.containers, keep your container as it is and add the proxy after it. Containers in one app share localhost, so the proxy reaches your site on the port your site listens on: 3000 here.

    my-site.yaml
    properties:  template:    containers:      - name: site                # your container, unchanged        image: myregistry.azurecr.io/my-site:latest      - name: awenen-proxy        image: awenen/proxy:0.1.0        resources:          cpu: 0.25          memory: 0.5Gi        env:          - name: Awenen__Upstream            value: http://localhost:3000          - name: Awenen__Key            secretRef: awenen-key          - name: Awenen__IngestUrl            value: https://ingest.awenen.com/v1/events        probes:          - type: Readiness            httpGet:              path: /status              port: 8081

    The app’s CPU and memory are the sum of its containers, and the total must be a combination Container Apps offers. Adding 0.25 CPU and 0.5 GiB keeps a valid total valid.

  4. Send visitors to the proxy

    In the same file, point the app’s ingress at the proxy’s port. Container Apps still ends HTTPS for you.

    my-site.yaml
    properties:  configuration:    ingress:      targetPort: 8080            # was your site's port
  5. Apply it

    Terminal
    az containerapp update --name my-site --resource-group my-rg --yaml my-site.yaml

    A new revision starts with both containers. Open your site, then check Proxies: the replica appears within a minute.

Things to know

  • The proxy speaks plain HTTP. Keep HTTPS where it ends today (your platform’s ingress, a load balancer, a reverse proxy) and point that at the proxy.
  • Never make port 8081 public. It serves the proxy’s status page for your own checks and probes.
  • Behind a CDN or Azure Front Door, tell the proxy which header carries the visitor’s address, or every request will look like it came from the CDN. See visitor addresses.
  • Size: a quarter of a CPU and 512 MB suits most sites. In our tests one CPU forwarded over 10,000 requests a second, using about 120 MB of memory.
  • Your firewall must let the proxy reach ingest.awenen.com over HTTPS. If it can’t, your site is unaffected but your dashboard stays empty.