apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: docs "Add a prefix to the route" possibly missing host proxy rewrite

Open poidl opened this issue 6 years ago • 1 comments

Issue description

I'm a beginner and just installed it. I went through the Getting Started and in "Add a prefix to the route" it says

Now lets say you want to add a prefix (eg: samplePrefix) to the route and do not want to use the host header then you can use the proxy rewrite plugin to do it.

below is the following code:

curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri": "/samplePrefix/get",
    "plugins": {
        "proxy-rewrite": {
          "scheme": "https",
          "regex_uri": ["^/samplePrefix/get(.*)", "/get$1"]
        },
        "key-auth": {}
    },
    "upstream_id": 50
}'

I think there is a "host":"httpbin.org" missing, at least this fixed it for me. Otherwise I had to include the host header in curl.

https://github.com/apache/incubator-apisix/blob/master/doc/getting-started.md#add-a-prefix-to-the-route

Environment

  • apisix version (cmd: apisix version): 1.4
  • OS: Arch Linux 5.7.5-arch1-1

Minimal test code / Steps to reproduce the issue

N/A

What's the actual result? (including assertion message & call stack if applicable)

N/A

What's the expected result?

N/A

poidl avatar Jul 01 '20 16:07 poidl

Sorry I tried it again and everything works as described in the docs! Thanks!

poidl avatar Jul 01 '20 19:07 poidl