简体   繁体   English

从 terraform aws_lb_listener 中排除路径

[英]Exclude paths from terraform aws_lb_listener

I have an aws_lb_listener that redirects all traffics to HTTPS but I would like to exclude certain paths.我有一个 aws_lb_listener 将所有流量重定向到 HTTPS 但我想排除某些路径。 Is this possible?这可能吗? I only see a way to include not exclude.我只看到一种包含不排除的方法。

resource "aws_lb_listener" "web_http" {
  load_balancer_arn = aws_lb.web.arn
  port              = "80"
  protocol          = "HTTP"

  default_action {
    type = "redirect"
    redirect {
      port        = "443"
      protocol    = "HTTPS"
      status_code = "HTTP_301" # permanent redirect
    }
  }
}

You could make the redirect-to-https have a low priority — or high order as aws_lb_listener calls it — and create separate actions for the paths you want to exclude with a higher priority so that they get evaluated first.您可以使重定向到 https 具有低优先级 - 或aws_lb_listener所称的高顺序 - 并为要排除的具有更高优先级的路径创建单独的操作,以便首先评估它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM