Redirection
You can configure redirection by configuring the ELB Listener. Here’s an example that redirects http to https with a 302 status code:
.ufo/config.rb
Ufo.configure do |config|
config.elb.redirect.enabled = true
# defaults
# config.elb.redirect.code = 302 # IE: 302 or 301
# config.elb.redirect.port = 443
# config.elb.redirect.protocol = HTTPS
# required to use the redirect above
config.elb.ssl.enabled = true
config.elb.ssl.certificates = ["arn:aws:acm:us-east-1:111111111111:certificate/11111111-2222-3333-4444-555555555555"]
end
You should must set up SSL Support if you’re using this.
Reference
The table below covers each setting. Each option is configured in .ufo/config.rb
with config.OPTION
. The config.
portion is not shown for conciseness. IE: logger.level
vs config.logger.level
.
Name | Default | Description |
---|---|---|
elb.default_actions | nil | Override the Listener default actions. This provides you a lot of control. |
elb.enabled | auto | Enables creating the ELB. Can be “auto”, true or false. Auto means will create an ELB when role is web . |
elb.existing.dns_name | nil | For managed route53 record when using config.dns.domain option. Since UFO does not manage the ELB, this allows UFO to map the route53 dns record when needed. UFO infers the ELB dns name from the target group. However, in the case when the target group is associated with multiple ELBs, UFO cannot infer it and this setting is required. See: Existing Load Balancer Docs. |
elb.existing.target_group | nil | Existing ELB target group. When using elb.existing.target_group the other elb settings are ignored since they only apply the ELB ufo manages. In the case of using an existing target group, the ELB is managed outside of UFO. You’re bring your own ELB. |
elb.health_check_interval_seconds | 10 | Time, in seconds, between health checks. |
elb.health_check_path | / | Health check url path. |
elb.healthy_threshold_count | 3 | Number of health checks successes before considered healthy. |
elb.listener.enabled | Whether or not to create the standard listener with default port 80 | true |
elb.matcher | Target group matcher | nil |
elb.port | 80 | ELB Listener port |
elb.protocol_version | Protocol version | nil |
elb.redirect.code | 302 | Redirection status code |
elb.redirect.enabled | false | When set to true, the Listener redirect to HTTPS by default. You should also set up SSL. |
elb.redirect.port | 443 | Redirection status port |
elb.redirect.protocol | HTTPS | Redirection protocol |
elb.ssl.certificates | / | The ACM certificates to use. Example: [“arn:aws:acm:us-west-2:11111111:certificate/EXAMPLE”]. If only using one cert, can also just provide a String instead of an Array. Remember to also set ssl.enabled = true |
elb.ssl.enabled | false | Whether or not to enable the creationg of an SSL Listener. If enabled, ssl.certificate should be set. |
elb.ssl.port | 443 | ELB SSL Listener port |
elb.unhealthy_threshold_count | 3 | Number of health check failures before considered unhealthy. |