Object Storage - Enabling HTTPS on a static website using a custom domain
Learn how to configure your website and the OVHcloud Load Balancer to enable HTTPS
Objective
OVHcloud Object Storage can be used to host a static website inside an Object Storage bucket.
A static website contains only static content (HTML pages, images, videos, client-side scripts) whereas a dynamic website relies on server-side processing to process data and help render content.
However, OVHcloud Object Storage static website hosting does not support HTTPS. If you want to use HTTPS, you can use OVHcloud Load Balancer to serve a static website hosted on OVHcloud Object Storage and act as an SSL gateway.
The following document will explain how to configure your website and the OVHcloud Load Balancer to enable HTTPS.
Requirements
To enable HTTPS, you need:
- An OVHcloud Load Balancer which will serve the role of an SSL gateway and can offer protection against DDoS attacks.
- A registered domain name.
- You need to order a TLS certificate associated with your domain name at OVHcloud (optional if you already have a trusted TLS certificate associated with your domain name).
- You have to enable web hosting on your Object Storage bucket.
OVHcloud Console Access
- Direct link:
- Navigation path:
Bare Metal Cloud>Network>Load Balancer
Instructions
Step 1 - Configuring the Load Balancer
Step 1.1 - Add your certificate
Select your Load Balancer from the list, click the SSL tab then click Add Certificate.
In the Certificate type section, choose:
- Custom (upload PEM) to upload your certificate: paste it in Certificate (PEM), then paste its Private Key (PEM) and, if needed, its Certificate Chain (PEM).
- Free (Let's Encrypt) to have a free certificate issued and renewed automatically: enter your domain name in Domain(s).
Click Add Certificate.
Step 1.2 - Configure a server farm
You now need to configure a server farm and add it to your Load Balancer. A server farm is a pool of backend machines that will handle the workload.
Still from your Load Balancer, click the Server farms tab then click Create farm.
Enter the configuration of the new server farm, then click Create Farm:
- Name (optional)
- Protocol: HTTP
- Port: 80
- Zone: choose the region in which you have hosted your website
You now need to add servers to your server farm. Click Add server on the farm you created.
Enter the configuration information of your server, then click Add Server:
- Name (optional)
- Address: Enter the public IP associated with your static website default URL in the form
<bucket_name>.s3-website.<region>.io.cloud.ovh.net
You can retrieve this IP address by doing a dig command on the URL.
Example: using dig
Example: using host
Step 1.3 - Configure your frontends
The next step is to add frontends to your Load Balancer. A frontend will be the internet facing element of your Load Balancer and is responsible for handling and routing incoming requests.
From your Load Balancer, click the Frontends tab then click Create frontend. Fill in the fields, then click Create Frontend.
Add 2 frontends:
- One frontend whose sole purpose is to handle all incoming HTTP requests and redirect them to your domain name in HTTPS
- name (optional)
- protocol: HTTP
- port: 80
- zone: all zones
- default route: Redirect to URL, with
https://<domain_name>as the redirect URL
- One frontend that will handle all incoming HTTPS requests and perform the role of the SSL gateway
- name (optional)
- protocol: HTTPS
- port: 443
- zone: the region where your bucket sits
- default route: Route to farm, with the server farm previously created
- TLS certificate: the certificate that you created
- advanced settings > HTTP Header: Host
<website_endpoint>in the form<bucket_name>.s3-website.<region>.io.cloud.ovh.net
Step 1.4 - Apply changes
Once you have created and configured all the resources, do not forget to apply all the changes to the Load Balancer: in the Overview tab, click Apply in the Deployment field. The button label carries the number of pending changes, for example Apply 3 changes.
Step 2: Configure your DNS
This section is relevant only if your domain name is registered at OVHcloud. If you have an external domain name, please check with your provider.
In the OVHcloud Console, open Web Cloud, then Domain names, click your domain name and open the DNS zone tab.
Edit the two A records to add the public IP address of your Load Balancer: on the row of each record, click Modify in the Actions column, enter the IP address in Target, then click Save.
You can find the public IP address of your Load Balancer in the IPv4 field of its Overview tab.
Step 3: Test your website
Check that the website and the redirect work properly. Open a private browser to ensure that you do have a clean cache and type your domain name.
Example:
Go further
How to configure your OVHcloud Load Balancer
How to configure your DNS zone
For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analysed by our experts.
Join our community of users.