add support for redirect types in config
This commit is contained in:
parent
0b58316916
commit
d9ab7e77c1
11
config.go
11
config.go
@ -24,15 +24,22 @@ func config(redirects []Redirect) error {
|
||||
return fmt.Errorf("unable to parse source URL '%s': %v", redirect.sourceURL, err)
|
||||
}
|
||||
|
||||
var ruleName string
|
||||
var ruleName, action string
|
||||
if len(redirect.sourceURL) > 63 { // FortiOS only allows up to 63 characters
|
||||
ruleName = redirect.sourceURL[:62]
|
||||
} else {
|
||||
ruleName = redirect.sourceURL
|
||||
}
|
||||
|
||||
if redirect.statusCode == 301 { //translate to fortiOS syntax
|
||||
action = "redirect-301"
|
||||
} else {
|
||||
action = "redirect"
|
||||
}
|
||||
|
||||
fmt.Printf("edit \"%s\"\n", ruleName)
|
||||
fmt.Printf("set location %s\n", redirect.destinationURL)
|
||||
fmt.Println("set action redirect")
|
||||
fmt.Printf("set action %s\n", action)
|
||||
fmt.Println("config match-condition")
|
||||
fmt.Println("edit 0")
|
||||
fmt.Println("set object http-url")
|
||||
|
Loading…
Reference in New Issue
Block a user