workaround fortios max object name length
This commit is contained in:
parent
784ff2fcc9
commit
17cfaf377a
@ -24,7 +24,12 @@ func config(redirects []Redirect) error {
|
||||
return fmt.Errorf("unable to parse source URL '%s': %v", redirect.sourceURL, err)
|
||||
}
|
||||
|
||||
fmt.Printf("edit \"%s\"\n", redirect.sourceURL)
|
||||
var ruleName string
|
||||
if len(redirect.sourceURL) > 63 { // FortiOS only allows up to 63 characters
|
||||
ruleName = redirect.sourceURL[:62]
|
||||
} else {
|
||||
ruleName = redirect.sourceURL
|
||||
}
|
||||
fmt.Println("set action redirect")
|
||||
fmt.Printf("set location %s\n", redirect.destinationURL)
|
||||
fmt.Println("set action redirect")
|
||||
@ -39,7 +44,7 @@ func config(redirects []Redirect) error {
|
||||
fmt.Println("next")
|
||||
|
||||
// Add this rule to the policy map
|
||||
redirectPolicies[sourceURL.Host] = append(redirectPolicies[sourceURL.Host], redirect.sourceURL)
|
||||
redirectPolicies[sourceURL.Host] = append(redirectPolicies[sourceURL.Host], ruleName)
|
||||
}
|
||||
fmt.Println("end")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user