{
  "id": "10",
  "content": [
    {
      "type": "heading",
      "text": "Custom Errors, CORS & Useful Snippets"
    },
    {
      "type": "text",
      "html": "Serve friendly error pages and add CORS only where needed."
    },
    {
      "type": "text",
      "html": "<pre><code># Custom errors\nErrorDocument 404 /errors/404.html\nErrorDocument 500 /errors/500.html\n\n# Simple CORS for a JSON API (adjust domain!)\n&lt;IfModule mod_headers.c&gt;\nHeader set Access-Control-Allow-Origin \"https://sampleaddress.com\"\nHeader set Access-Control-Allow-Methods \"GET, OPTIONS\"\n&lt;/IfModule&gt;\n\n# Block access to hidden files\n&lt;FilesMatch \"^\\.(ht|git|env)\"&gt;\nRequire all denied\n&lt;/FilesMatch&gt;</code></pre>"
    },
    {
      "type": "text",
      "html": "Remember to upload the referenced error pages (e.g., <code>/errors/404.html</code>)."
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "Which directive maps HTTP 404 to your custom page?",
        "options": [
          {
            "id": "a",
            "text": "ErrorPage 404"
          },
          {
            "id": "b",
            "text": "ErrorDocument 404"
          },
          {
            "id": "c",
            "text": "Custom404"
          }
        ],
        "correct": [
          "b"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "CORS should be configured:",
        "options": [
          {
            "id": "a",
            "text": "Wide-open for all origins"
          },
          {
            "id": "b",
            "text": "Only for specific origins and paths"
          },
          {
            "id": "c",
            "text": "Never on APIs"
          }
        ],
        "correct": [
          "b"
        ]
      }
    ]
  }
}