Configure HTTP → HTTPS redirect
Configure HTTP → HTTPS redirect
You can configure HTTP → HTTPS redirect.
HTTP requests from port 80 will be redirected to port 443.
-
Create a Listener, a rule for a balancer with HTTP protocol and port 80:
openstack loadbalancer listener create \
--name <listener_name> \
--protocol HTTP \
--protocol-port 80 \
<loadbalancer>Specify:
<listener_name>
is the listener's name;<loadbalancer>
— ID or name of the load balancer, can be viewed viaopenstack loadbalancer list
-
To display the rule correctly in the control panel, you need to create a Pool and a default Member — traffic not covered by the L7 policy will be redirected there.
Create a Pool — add the HTTP protocol for the server to the rule and specify the algorithm:
openstack loadbalancer pool create \
--name <pool_name> \
--lb-algorithm <algorithm> \
--loadbalancer <loadbalancer> \
--protocol HTTPSpecify:
<pool_name>
is the pool name;<algorithm>
is the name of the algorithm:ROUND_ROBIN
orLEAST_CONNECTIONS
;<loadbalancer>
— ID or name of the load balancer, can be viewed viaopenstack loadbalancer list
-
Create Member — add the server to the rule and specify its IP address:
openstack loadbalancer member create \
--subnet-id <subnet_id> \
--address <server_ip> \
--protocol-port 80 \
<pool>Specify:
<subnet_id>
— ID of private or public subnet, can be viewed withopenstack subnet list
;<server_ip>
— IP address of the server;<pool>
— pool name or ID, can be viewed withopenstack loadbalancer pool list
-
Create an L7 policy in the created listener:
openstack loadbalancer l7policy create \
--action REDIRECT_TO_URL \
--redirect-url <domain_name> \
--name <policy_name> \
<listener>Specify:
<domain_name>
is a domain of the formhttps://example.com/
;<policy_name>
is the name of the L7 policy;<listener>
— listener ID or name, can be viewed withopenstack loadbalancer listener list
-
Create an L7 rule in the L7 policy:
openstack loadbalancer l7rule create {
--compare-type EQUAL_TO {
--type HOST_NAME {
--value <domain_name> {
<policy>Specify:
<domain_name>
is a domain of the formhttps://example.com/
;<policy>
— ID or name of the L7policy, can be viewed withopenstack loadbalancer l7policy list