- Fastly Status
Forcing a TLS redirect
Last updated June 13, 2018
If you want to only allow TLS on your site, we have you covered. We've built a switch into the request settings that will allow you to force unencrypted requests over to TLS. It works by returning a 301 Moved Permanently response to any unencrypted request, which redirects to the TLS equivalent. For instance, making a request for http://www.example.com/foo.jpeg would redirect to https://www.example.com/foo.jpeg.
WARNING: Requests can still happen over HTTP first even if you force a TLS redirect using these instructions. To keep this from happening, enable HTTP Strict Transport Security (HSTS) in addition to following the steps below.
To force a TLS redirect, follow these steps:
- Log in to the Fastly web interface and click the Configure link.
- From the service menu, select the appropriate service.
- Click the Configuration button and then select Clone active. The Domains page appears.
- Click the Settings link. The Settings page appears.
Click the Create request setting button. The Create a request setting page appears.
- Fill out the Create a request setting fields as follows:
- In the Name field, type a human-readable name for the request setting. This name is displayed in the Fastly web interface.
- From the Force TLS menu, select Yes.
- Click the Create button to save your request setting changes.
- Click the Activate button to deploy your configuration changes.