Orchardcore reverse proxy

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore reverse proxy is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for configuring reverse proxy support in Orchard Core. Covers the forwarded headers middleware (X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-Prefix), ReverseProxySettings in the admin UI and the settings recipe step, the OrchardCore ReverseProxy configuration section with

How to use this skill

Skill file

Orchard Core Reverse Proxy - Prompt Templates

Configure Reverse Proxy Support

You are an Orchard Core expert. Generate configuration and code for reverse proxy scenarios including forwarded headers, trusted proxy networks, and multi-tenant deployments behind load balancers.

Guidelines

Enabling and Configuring via Recipe

{
  "steps": [
    {
      "name": "feature",
      "enable": [
        "OrchardCore.ReverseProxy"
      ]
    },
    {
      "name": "settings",
      "ReverseProxySettings": {
        "ForwardedHeaders": "XForwardedFor, XForwardedProto",
        "KnownNetworks": [ "10.0.0.0/8" ],
        "KnownProxies": [ "10.0.0.4" ]
      }
    }
  ]
}

With OrchardCore.Deployment enabled, the Reverse Proxy settings deployment step exports the same ReverseProxySettings object.

Configuration Options

| Setting | Description | Example Values |

|---------|-------------|----------------|

| ForwardedHeaders | Headers to process | XForwardedFor, XForwardedHost, XForwardedProto, All |

| KnownNetworks | Trusted proxy networks in CIDR notation | ["192.168.1.0/24", "10.0.0.0/8"] |

| KnownProxies | Trusted proxy IP addresses | ["192.168.1.200", "192.168.1.201"] |

File-Based Configuration

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddOrchardCms()
    .ConfigureReverseProxySettings();

var app = builder.Build();

app.UseOrchardCore();

app.Run();
{
  "OrchardCore": {
    "ReverseProxy": {
      "ForwardedHeaders": "XForwardedFor, XForwardedHost, XForwardedProto",
      "KnownNetworks": [ "10.0.0.0/8" ],
      "KnownProxies": [ "10.0.0.1" ]
    }
  }
}

Environment variables:

OrchardCore__ReverseProxy__ForwardedHeaders=XForwardedFor, XForwardedProto
OrchardCore__ReverseProxy__KnownProxies__0=10.0.0.1

Partial Override

Only the properties present in configuration override the admin values:

{
  "OrchardCore": {
    "ReverseProxy": {
      "KnownProxies": [ "10.0.0.1" ]
    }
  }
}

Here KnownProxies comes from configuration while ForwardedHeaders and KnownNetworks come from the admin UI.

Multi-Tenant Considerations

{
  "ReverseProxy": {
    "ForwardedHeaders": "XForwardedFor, XForwardedProto",
    "KnownProxies": [ "10.0.1.100" ]
  }
}

Security Considerations

  1. Always configure KnownProxies and/or KnownNetworks; empty lists trust forwarded headers from any client, which allows IP spoofing that bypasses rate limits and pollutes audit data.
  2. Forward only the headers the proxy actually sets. XForwardedHost lets callers choose the host used to resolve tenants and build absolute URLs.
  3. Keep CIDR ranges narrow; do not trust whole public ranges.
  4. Verify with a request that HttpContext.Connection.RemoteIpAddress and Request.Scheme show the client IP and https.

Upgrading from 3.x

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.