Feed integration / Edge routing examples

Feed integration

Edge routing examples

Ready-to-use /feed rules for NGINX, Amazon CloudFront, AWS ALB and Cloudflare Workers.

Use the example that matches the first HTTP routing layer on your website. Replace www.example.com with your public host. Every example applies the values in Connection details.

Reverse proxy: NGINX

Inside the existing HTTPS server block for your site, before other location rules that could match /feed:

nginx.conf
location ~ ^/feed(/|$) {
    limit_except GET { deny all; }   # GET also permits HEAD
    proxy_pass https://feeds.branly.ai;   # path + query unchanged
    proxy_set_header Host feeds.branly.ai;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header Cookie "";
    proxy_set_header Authorization "";
    proxy_ssl_server_name on;
    proxy_ssl_name feeds.branly.ai;
    proxy_ssl_verify on;
    # CA bundle path: adjust for your OS
    proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
}

If NGINX sits behind a CDN that changes the Host header, set X-Forwarded-Host to your public host as a fixed value instead of $host.

CDN: Amazon CloudFront

Add an origin feeds.branly.ai, protocol HTTPS only, with an origin custom header X-Forwarded-Host = your public host.

Create two behaviors ahead of the default one: /feed and /feed/*, both pointing to that origin.

Allowed methods: GET, HEAD. Cache policy: CachingDisabled. Origin request policy: AllViewerExceptHostHeader (forwards query strings and headers; CloudFront then sends our Host).

Optional: a behavior /feed/_next/static/* with CachingOptimized for the versioned files.

Load balancer: AWS ALB

An ALB can't forward to an external host. If the ALB is your first HTTP router, add a higher-priority HTTPS listener rule for paths /feed and /feed/* that forwards to a small proxy target group (for example NGINX with the snippet above).

If CloudFront is in front of the ALB, use the CloudFront example instead.

Cloudflare Worker

Add routes www.example.com/feed and www.example.com/feed/* for this Worker:

worker.js
export default {
  async fetch(request) {
    if (!['GET', 'HEAD'].includes(request.method)) {
      return new Response('Method not allowed', { status: 405 });
    }
    const url = new URL(request.url);
    const headers = new Headers(request.headers);
    headers.delete('cookie');
    headers.delete('authorization');
    headers.set('X-Forwarded-Host', url.hostname);
    return fetch('https://feeds.branly.ai' + url.pathname + url.search, {
      method: request.method,
      headers,
      redirect: 'manual',
    });
  },
};

Test at the edge

At the public edge, test /feed, a post, the sitemap and a normal website URL. Check that site-wide cache rules, bot rules and custom error pages don't apply to /feed. The full list of checks is in Verify and launch.

Platform documentation: CloudFront cache behaviors · ALB listener rules · NGINX proxy module · Cloudflare Workers routes

Last updated 19 November 2026

Questions about this page? Write to connect@branly.ai