Orchardcore https

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore https is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for enforcing HTTPS and HSTS per Orchard Core tenant. Covers HttpsSettings, IHttpsService, HTTPS redirection, permanent redirect status, SSL port selection, HSTS modes, admin settings, the settings recipe step, reverse proxy TLS termination, and deployment. Use this skill when requests mention

How to use this skill

Skill file

Orchard Core HTTPS - Prompt Templates

Enforce HTTPS and HSTS

You are an Orchard Core expert. Generate safe tenant-specific HTTPS configuration for Orchard Core.

Guidelines

Enabling HTTPS

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Https"
      ],
      "disable": []
    }
  ]
}

Configuring HTTPS in the Admin

Navigate to Settings → Security → HTTPS using an HTTPS connection. The page requires the ManageHttps permission. Configure:

| Setting | Behavior |

|---|---|

| Require HTTPS | Redirects HTTP requests to HTTPS. |

| Permanent redirect | Uses HTTP 308 for the redirect. |

| SSL port | Overrides automatic HTTPS port detection when necessary. |

| Strict transport security | Controls HSTS mode for this tenant. |

Settings changes request a tenant shell release so the pipeline reads the new values.

Configuring HTTPS via Recipe

HttpsSettings is a site setting, so use the settings step:

{
  "steps": [
    {
      "name": "feature",
      "enable": [ "OrchardCore.Https" ]
    },
    {
      "name": "settings",
      "HttpsSettings": {
        "RequireHttps": true,
        "RequireHttpsPermanent": true,
        "SslPort": 443,
        "StrictTransportSecurityMode": "FromConfiguration"
      }
    }
  ]
}

StrictTransportSecurityMode accepts Disabled (default), Enabled, or FromConfiguration. A recipe import writes the settings directly; reload an already-running tenant so the pipeline picks them up.

HttpsSettings

using OrchardCore.Https.Settings;

var settings = new HttpsSettings
{
    RequireHttps = true,
    RequireHttpsPermanent = true,
    SslPort = 443,
    StrictTransportSecurityMode = HttpStrictTransportSecurityMode.FromConfiguration,
};

EnableStrictTransportSecurity is a legacy obsolete property. Do not set it in new code; use StrictTransportSecurityMode.

Reading Tenant HTTPS Settings

Inject IHttpsService when a component needs to inspect the current tenant configuration.

using OrchardCore.Https.Services;
using OrchardCore.Https.Settings;

namespace MyModule.Services;

public sealed class HttpsStatusProvider
{
    private readonly IHttpsService _httpsService;

    public HttpsStatusProvider(IHttpsService httpsService)
    {
        _httpsService = httpsService;
    }

    public async Task<bool> IsRequiredAsync()
    {
        HttpsSettings settings = await _httpsService.GetSettingsAsync();
        return settings.RequireHttps;
    }
}

Runtime Pipeline Behavior

During tenant pipeline setup, the module:

  1. Reads HttpsSettings through IHttpsService.
  2. Adds HTTPS redirection if RequireHttps is true.
  3. Adds HSTS if the mode is Enabled.
  4. Adds HSTS in Production only if the mode is FromConfiguration.

It configures HttpsRedirectionOptions.HttpsPort from SslPort and changes the redirect status to 308 when permanent redirects are selected.

Reverse Proxy Configuration

At a TLS-terminating proxy, enable OrchardCore.ReverseProxy with XForwardedProto and the trusted KnownProxies/KnownNetworks (see orchardcore-reverse-proxy), or configure forwarded headers in the host before the Orchard Core pipeline runs. Do not use RequireHttps until the application recognizes proxied HTTPS requests correctly.

Deployment

With OrchardCore.Deployment enabled, the module registers the Https settings site-settings deployment step.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Https",
        "OrchardCore.Deployment"
      ],
      "disable": []
    }
  ]
}

Use deployment carefully across environments. An imported production HTTPS setting can be inappropriate for a local HTTP-only development tenant.

HSTS Safety

Troubleshooting

| Symptom | Check |

|---|---|

| Redirect loop behind a proxy | Ensure forwarded HTTPS scheme headers are trusted and processed. |

| Cannot save HTTPS settings | Open the admin settings page over HTTPS. |

| HSTS is absent in development | FromConfiguration deliberately enables it only in Production. |

| Wrong redirect port | Set SslPort when the server cannot infer the target HTTPS port. |

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.