---
title: "HTTP to HTTPS Redirect"
slug: "http-to-https-redirect-1"
updated: 2025-05-21T10:14:17Z
published: 2025-05-21T10:14:17Z
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwilt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HTTP to HTTPS Redirect

## Overview

If you want to block your site from being accessed over HTTP, you can configure an HTTP to HTTPS Redirect rule to force the CDN to redirect HTTP requests to HTTPs. The rule configuration also sets the response code.

## Configure the Rule

Here, we'll describe how to configure the rule with the Delivery Service Management UI.

API Users may choose to [build the site configuration offline](https://api-docs.qwilt.cqloud.com/docs/CDN%20APIs/Sites%20API/prepare-the-configuration-json).

**To configure an HTTP to HTTPs Redirect rule:**

1. [Navigate to the Select Rule dialog](/v1/docs/add-a-rule).
2. In the Select Rule dialog, choose **HTTP to HTTPs Redirect**.
3. Toggle **On** the **HTTP to HTTPS Redirect** feature. ![HTTP2HTTPSRedirect.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/HTTP2HTTPSRedirect.png)
4. From the **Redirect HTTP Status Code** field, select the relevant code. The status code affects how the client handles the redirect.

| Status Code | Description |
| --- | --- |
| 301 | Permanent redirect that tells the client the resource is permanently moved to the new HTTPS URL. This is the default status code value. |
| 302 | Temporary redirect that tells the client the resource is temporarily located at the new HTTPs URL. |
| 307 | Temporary redirect that also ensures that the HTTP method and body remain unchanged in the redirected request. Use this code when it's critical to maintain the original request method and body (such as for POST requests). |
| 308 | Permanent redirect that also ensures that the HTTP method and body remain unchanged in the redirected request. Use this code when it's critical to maintain the original request method and body (such as for POST requests). |
5. Choose **Add Rule**.

## SVTA Component: QW.HTTPtoHTTPSRedirect

When you save the configuration version, the **QW.HTTPtoHTTPSRedirect** component is added to the JSON configuration. This is a [private feature developed by Qwilt](https://api-docs.qwilt.cqloud.com/docs/CDN%20APIs/Sites%20API/Site%20Configuration%20JSON%20Format/prepare-the-configuration-json#qwilt-private-features).

This example forces an HTTP to HTTPs redirect with status code 301.

```
{
  "generic-metadata-type": "MI.PrivateFeature.Qwilt.QW.HTTPtoHTTPSRedirect",
  "generic-metadata-value": {
    "allow-redirect": true,
    "redirect-code": "301"
  }
}
```

| Attribute | Valid Values |
| --- | --- |
| allow-redirect | true, false |
| redirect-code | 301, 302, 307, 308 |
