Learn how to integrate your web services behind an OVHcloud Load Balancer with redirections.
The OVHcloud Load Balancer acts by default as a proxy. It can also be configured to redirect your customers to a third-party website, which is useful if you are changing your domain name, or want to redirect your customers to your website’s HTTPS version, for example. This is known as HTTP redirection.
Requirements
- an OVHcloud Load Balancer
- access to the OVHcloud Control Panel or OVHcloud API
Instructions
Presentation
An HTTP redirection is presented as follows:
Custom redirections should have the following form: <scheme>://<net_loc>/<path>;<params>?<query>#<fragment>
. You can only specify one redirection per front-end.
Custom redirections can be specified via the OVHcloud Control Panel and API, both on new and existing front-ends
.
Add a custom redirection via the OVHcloud Control Panel
You can define custom redirections from the OVHcloud Control Panel by going to the Cloud
section, then Load Balancer
.
You can either do this on a new front-end as you create it or on an existing front-end.
You can follow these instructions to create a new front-end, but take note of the following during the creation:
In the editing page for a front-end, select HTTP
or HTTPS
protocol. Configure the information as requested. However, please note that there is no need to set a Default farm
, as it will not be used.
In the advanced settings, enter the HTTP redirection
.
Once the front-end has been configured, click Add
. Please remember to deploy the configuration. There are two ways of doing this:
-
via the
Status
section of the OVHcloud Control Panel, by clicking on your Load Balancer’s...
button, then selectingApply configuration
-
via the reminder box in the OVHcloud Control Panel, notifying you that the configuration has not been applied, by clicking
Apply configuration
In the Front-ends
section of the OVHcloud Control Panel, select the front-end you would like to edit. To do this, click the more options ...
button, then select Edit
in the menu that appears. Please ensure that the front-end you have chosen uses either HTTP
or HTTPS
protocol.
In the editing page for the front-end, complete the configuration if needed. However, please note that there is no need to set a Default farm
, as it will not be used.
In the advanced settings, enter the HTTP redirection
.
Once the front-end has been configured, click Modify
. Please remember to deploy the configuration. There are two ways of doing this:
-
via the
Status
section of the OVHcloud Control Panel, by clicking on your Load Balancer’s...
button, then selectingApply configuration
-
via the reminder box in the OVHcloud Control Panel, notifying you that the configuration has not been applied, by clicking
Apply configuration
Add a custom redirection via the API
In the OVHcloud API, redirections are specified in the redirectLocation character chain.
- If you are creating a new front-end:
POST /ipLoadbalancing/{serviceName}/http/frontend
Setting | Meaning |
---|---|
serviceName | Your Load Balancer service ID |
port | Front-end listening ports |
zone | Front-end deployment zones |
redirectLocation | HTTP redirection URL |
- If you are updating an existing front-end:
PUT /ipLoadbalancing/{serviceName}/http/frontend/{frontendId}
Setting | Meaning |
---|---|
serviceName | Your Load Balancer service ID |
frontendId | ID of the front-end to be updated |
redirectLocation | HTTP redirection URL |
- Then apply the modifications:
POST /ipLoadbalancing/{serviceName}/refresh
Setting | Meaning |
---|---|
serviceName | Your Load Balancer service ID |
zone | Front-end deployment zones |
Go further
For more information and tutorials, please see our other OVHcloud Load Balancer guides or explore the guides for other OVHcloud products and services.