Skip to content

Instantly share code, notes, and snippets.

@markuman
Created July 12, 2019 11:40
Show Gist options
  • Save markuman/faedd97f5c1af43c2935751103684c16 to your computer and use it in GitHub Desktop.
Save markuman/faedd97f5c1af43c2935751103684c16 to your computer and use it in GitHub Desktop.
http_rules:
- Conditions:
- Field: host-header
Values:
- some.domain
Actions:
- RedirectConfig:
Host: "jfkdsd.cloudfront.net"
Path: "/#{path}"
Port: "443"
Protocol: "HTTPS"
Query: "#{query}"
StatusCode: "HTTP_301"
Type: redirect
- Conditions:
- Field: path-pattern
Values:
- "/AutoDiscover/autodiscover.xml"
Actions:
- FixedResponseConfig:
ContentType: "text/plain"
MessageBody: "Not found here ..."
StatusCode: "404"
Type: fixed-response
listeners:
- Protocol: HTTP
Port: 80
DefaultActions:
- Type: redirect
RedirectConfig:
Protocol: HTTPS
Host: "#{host}"
Query: "#{query}"
Path: "/#{path}"
Port: "443"
StatusCode: HTTP_301
Rules: "{{ http_rules | add_priority }}"
#!/usr/bin/python
class FilterModule(object):
def filters(self):
return {
'add_priority': self.add_priority
}
def add_priority(self, input):
retval = list()
counter = 1
for item in input:
item['Priority'] = str(counter)
counter += 1
retval.append(item)
return retval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment