# Create Rule

# usage

Usage: oredge rule create [OPTIONS]

OPTIONS:
    --http integer                     application http id.
    --action json                      action, can add mutilple times.
        type string                    action type: set-uri,add-uri-prefix,rm-uri-prefix,rm-uri-seg,set-req-header,add-req-header,set-uri-arg,add-uri-arg,rm-uri-arg,set-proxy-uri,rewrite-proxy-uri-prefix,set-proxy-header,append-proxy-header-value,enable-proxy-cache-revalidate,set-proxy-cache-use-stale,redirect,print,exit,sleep,limit-req-rate,limit-req-count
        set-uri object                 
            uri string
        add-uri-prefix object
            value string
        rm-uri-prefix object
            value string         
        rm-uri-seg object
            index integer
        set-req-header object
            header string
            value string
        add-req-header object
            header string
            value string
        set-uri-arg object
            arg string
            value string
        add-uri-arg object
            arg string
            value string
        rm-uri-arg object
            arg string
            value string
        set-proxy-uri object
            uri string
        rewrite-proxy-uri-prefix object
            prefix string
            replacement string
        set-proxy-header object
            header string
            value string
            el_var string              client-addr,client-port,host,scheme,first-x-forwarded-addr,last-x-forwarded-addr,req-header,system-hostname,ssl-client-s-dn
            el_var_arg string          when el_var is req-header, this field is required.
        append-proxy-header-value object
            header string
            value string
            el_var string              client-addr,client-port,host,scheme,first-x-forwarded-addr,last-x-forwarded-addr,req-header,system-hostname,ssl-client-s-dn
            el_var_arg string          when el_var is req-header, this field is required.
        enable-proxy-cache-revalidate object
            enabled bool
        set-proxy-cache-use-stale object
            args array string          error,timeout,invalid_header,updating,http_500,http_502,http_503,http_504,http_403,http_404,http_429
        redirect object
            args string
            code integer
            host string
            port integer
            scheme string
            url string
        print object
            content_type string
            msg string
        exit object
            code integer
        sleep object
            time integer
        limit-req-rate object
            edge_captcha_clearance_time integer
            edge_captcha_clearance_time integer
            hcaptcha_clearance_time integer
            limit_key string
            rate_reject integer
            rate_reject_unit string
            rate_shape integer
            rate_shape_unit string
            reject_action string
        limit-req-count object
            count_reject integer
            count_time_window integer
            limit_key string           client-addr,uri,uri-arg,req-cookie,first-x-forwarded-addr,last-x-forwarded-addr.
            key_arg string             is required where limit_key is uri-arg,req-cookie.
        block-req object
            block_threshold integer
            block_time integer
            limit_key string           client-addr,uri,uri-arg,req-cookie,first-x-forwarded-addr,last-x-forwarded-addr.
            observe_interval integer
            rate_reject integer
            rate_reject_unit string
            rate_shape integer
            rate_shape_unit string
    --cache json                       cache. 
    --comment string                   comment.
    --condition json                   condition, can add mutilple times.
        variable object
            name string                variable name, uri,uri-arg,uri-seg,query-string,sorted-query-string,host,req-method,req-cookie,req-header,scheme,server-port,server-addr,first-x-forwarded-addr,last-x-forwarded-addr.
            args string|integer        args.
        operator object
            name string                operator name, eq,ne,lt,le,gt,ge,contains,contains-word,prefix,suffix,!contains,!contains-word,!prefix,!suffix.
        values array object
            type string                str or rx or wc. 
            value string               value. 
        caseless bool                  is caseless, true or false.
    --content json                     content.
    --last bool                        last, true or false.
    --order integer                    order.
    --proxy json                       proxy.
    --waf json                         waf.

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --json                             print json format.
    --config                           specify config file, default is ~/.oredge/config.

# example

  1. create rule.
# oredge rule create 892 --last true
ID: 892-1551