{
    "type": "array",
    "maxItems": 70,
    "default": [],
    "items": {
        "type": "object",
        "required": [
            "from",
            "redirect"
        ],
        "additionalProperties": false,
        "properties": {
            "from": {
                "type": "object",
                "required": [
                    "port",
                    "hostname",
                    "uri"
                ],
                "additionalProperties": false,
                "description": "only uniq objects, only one 'default' per port, only one 'any' per port",
                "properties": {
                    "port": {
                        "type": "integer",
                        "enum": [
                            80,
                            443
                        ]
                    },
                    "hostname": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "type"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "any",
                                    "fqdn"
                                ],
                                "description": "'fqdn' - specific value of hostname; 'any' - any hostname"
                            },
                            "value": {
                                "type": "string",
                                "description": "value of hostname if type='fqdn'"
                            }
                        }
                    },
                    "uri": {
                        "oneOf": [
                            {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                    "value",
                                    "type"
                                ],
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "exact",
                                            "stop",
                                            "subdir"
                                        ],
                                        "description": "'exact' - exact match with URI-path; 'stop' - prefix-based matching, the longer prefix will \"win\"; 'subdir' - prefix-based matching, same as 'stop', deprecated, use 'stop' instead"
                                    },
                                    "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                    }
                                }
                            },
                            {
                                "type": "null",
                                "description": "If 'type' is null, any URI matches"
                            }
                        ],
                        "default": null
                    }
                }
            },
            "redirect": {
                "oneOf": [
                    {
                        "type": "null",
                        "description": "Redirect is disabled, blocks less specific redirects"
                    },
                    {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "code",
                            "hostname",
                            "port",
                            "path",
                            "args"
                        ],
                        "properties": {
                            "code": {
                                "type": "integer",
                                "enum": [
                                    301,
                                    302,
                                    307,
                                    308
                                ],
                                "description": "Response code"
                            },
                            "schema": {
                                "anyOf": [
                                    {
                                        "type": "string",
                                        "enum": [
                                            "http",
                                            "https"
                                        ]
                                    },
                                    {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 10
                                    }
                                ],
                                "description": "http or https or custom schema"
                            },
                            "hostname": {
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "minLength": 3,
                                        "maxLength": 250
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "string - validated hostname, null - leave as is (from request)"
                            },
                            "port": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 65535,
                                "description": "Redirect to port"
                            },
                            "path": {
                                "oneOf": [
                                    {
                                        "type": "string",
                                        "minLength": 0,
                                        "maxLength": 500
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "nullable": true,
                                "default": null,
                                "description": "string - only url-allowed chars, null - leave as is (from request)"
                            },
                            "args": {
                                "type": "boolean",
                                "default": true,
                                "description": "true - means leave as is, false - remove any query args"
                            }
                        }
                    }
                ]
            }
        }
    }
}
