{
  "id": 20592721,
  "title": "Moodle behind TLS offload needs $CFG->sslproxy",
  "url": "https://urgent.news/2026/11/18/moodle-behind-tls-offload-needs-cfg-sslproxy",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-18T12:17:44.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/luukverhoeven/moodle-behind-tls-offload-needs-cfg-sslproxy-5h28"
  },
  "original_language": "en",
  "account": "Moodle requires $CFG- sslproxy to be set to true when using an external SSL appliance for performance reasons. This flag allows Moodle to generate HTTPS URLs even if the PHP pool is accessed via HTTP on localhost. If this flag is missing, users may encounter issues such as 302 loops, mixed-content warnings, and session cookies without the Secure flag.\n\nWhen $CFG- sslproxy is enabled, Moodle will not set the Strict-Transport-Security (HSTS) header, which should be set at the TLS terminator level instead. The $CFG- wwwroot must match the URL students type, including \"https://\" with no trailing slash. If both $CFG- sslproxy and $CFG- reverseproxy are enabled, Moodle may refuse access with an error message.\n\nTo ensure proper functionality, it is essential to redirect HTTP traffic to HTTPS using a redirect rule on the TLS terminator. Health checks should be performed over the internal HTTP port from the private network, using a Host header, without publishing that port. Additionally, running cURL commands after every proxy change and after cloning the stack into a new cluster is recommended to prevent mixed-content issues.",
  "summary": "Moodle™ sees the request PHP received. If nginx, HAProxy, an F5, or Cloudflare terminates TLS and the PHP pool speaks HTTP on localhost, $_SERVER['HTTPS'] is empty. $CFG->wwwroot is still https://lms.example.org . Login then 302-loops, cookies drop the Secure flag, and generated URLs flip to http:// . config-dist.php names the switch: // Enable when using external SSL appliance for performance…",
  "key_points": [
    "$CFG- sslproxy must be set to true for external SSL appliance",
    "Enables Moodle to generate HTTPS URLs via HTTP on localhost",
    "Missing flag causes 302 loops, mixed-content warnings"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}