CORS implementation
After hours of struggling with syntax errors, support helped identify a correction I'll pass along.
1) I wasn't able to define the class inside of the iRule and had to create a Data Group object (type: string) that contained the allowed origins as String with a blank value.
If the though of using a GUI brings a tear to your eye, here's the CLI:
ltm data-group internal DG-CORS-ALLOWED-ORIGINS {
records {
.authorizeddomain.com { }
localhost:3456 { }
}
type string
}
2) The syntax in OP's iRule required the addition of more brackets.
This lines gives me an error: /Common/IRULE-CORS:10: error: [parse error: PARSE syntax 228 {syntax error in expression " class match [HTTP::header Origin] ends_with allowed_origins...": variable references require preceding $}][{ class match [HTTP::header Origin] ends_with allowed_origins }]
if { class match [HTTP::header Origin] ends_with DG-CORS-ALLOWED-ORIGINS }
Enclosed class in brackets and received no syntax errors:
if { [class match [HTTP::header Origin] ends_with DG-CORS-ALLOWED-ORIGINS] }
This was tested in LTM 11.6.0