Giter VIP home page Giter VIP logo

Comments (5)

sumory avatar sumory commented on June 6, 2024

As the final implementation of extractor for Orange, there are two extractors designed for the above specifics called index extractor and template extractor.

index extractor

This is the default extractor for Orange v0.1.*. And now one small change is added to it which works well with backward compatibility. The new feature is named as default value.

index extractor configuration format:

"extractor": {
        "type": 1, // index extractor
        "extractions": [
            {
                "type": "Query",
                "name": "wd"
            },
            {
                "type": "Header",
                "name": "from",
                "default": "this_is_default_value" // used as default value if `from` not exists in "Header"
            }
        ]
}

then use these variables extracted with this grammar ${1} or ${2} ...

template extractor

This is a more flexible extractor aiming at solving the above requirement.

template extractor configuration format:

"extractor": {
        "type": 2, // template extractor
        "extractions": [
                    {
                        "type": "Query",
                        "name": "wd",
                        "default": "orange"
                    },
                    {
                        "type": "URI",
                        "name": "/redirect_baidu/(.*)/go"
                    }
        ]
}

then use these variables extracted with this grammar {{body.post_arg1}} or {{header.uid}} or {{query.abc}} or {{uri.v1}} or {{ip}} ...

e.g. http://baidu.com/s?wd={{query.wd}}&uri_arg={{uri.v1}}.

the default value feature is also supported by template extractor.

from orange.

syhily avatar syhily commented on June 6, 2024

So, the only restriction on template extractor is that we could only have one URI extractor.

from orange.

sumory avatar sumory commented on June 6, 2024

there should be only one "URI" extraction in the extractions part of an extractor.
you could extract all variables from uri with a RegEx, and then use them with {{uri.v1}}/{{uri.v2}}/{{uri.v3}}...

from orange.

antong530 avatar antong530 commented on June 6, 2024

您好,这边想通过proxy_pass对url进行重写,但是后面的参数是不确定的,用您的queryString没有参数,请问这样该怎么解决

from orange.

sumory avatar sumory commented on June 6, 2024

proxy_pass的uri是可以通过配置自定义的,而且默认情况下“分流”插件不会覆盖或者抹除原来的请求参数。
如果有更细粒度的url控制需求请使用“URL重定向“或”URI重写“插件。

from orange.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.