navendu-pottekkat commented on code in PR #6929: URL: https://github.com/apache/apisix/pull/6929#discussion_r860464770
########## docs/en/latest/getting-started.md: ########## @@ -232,151 +251,55 @@ curl "http://127.0.0.1:9080/apisix/admin/upstreams/1" -H "X-API-KEY: edd1c9f0343 }' ``` -We use `roundrobin` as the load balancing mechanism and set `httpbin.org:80` as our Upstream service with an ID of `1`. See [Admin API](./admin-api.md) for more information about the fields. +This is the same as the Upstream service we configured directly into the Route on the previous section. -<!-- -# -# In addition to the basic Markdown syntax, we use remark-admonitions -# alongside MDX to add support for admonitions. Admonitions are wrapped -# by a set of 3 colons. -# Please refer to https://docusaurus.io/docs/next/markdown-features/admonitions -# for more detail. -# ---> - -:::note Note -Creating an Upstream service is not mandatory as we can use a [Plugin](./architecture-design/plugin.md) to intercept the request and then respond directly. However, for the purposes of this guide, we assume that at least one Upstream service needs to be set up. -::: - -### Binding the Route to the Upstream - -We can now bind a Route to the Upstream service we just created. +To bind this Upstream to the Route, we can use the `upstream_id` as `1`: ```bash curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' { - "uri": "/get", - "host": "httpbin.org", - "upstream_id": "1" -}' -``` - -## Step 3: Validating the Route - -We will now access Apache APISIX to test the Route and the bounded Upstream service. - -```bash -curl -i -X GET "http://127.0.0.1:9080/get?foo1=bar1&foo2=bar2" -H "Host: httpbin.org" -``` - -This will return the data from the Upstream service we configured in our route (`httpbin.org`). - -## Advanced Features and Operations - -This section looks at some of the advanced features and operations available in Apache APISIX like [authentication](#authentication), [prefixing a Route](#prefixing-a-route), using the [APISIX Dashboard](#apisix-dashboard), and [troubleshooting](#troubleshooting). - -### Authentication - -The Route we created in [step 2](#step-2-create-a-route) is public. This means that anyone knowing the address exposed by Apache APISIX can access the Upstream service. - -This is unsafe and amounts to security risks. So, in practical applications, we generally add authentication to the Route to enhance security. - -Let's assume for our scenario that we only want a specific user `John` to have access to the Upstream service. - -We will use [Consumer](./architecture-design/consumer.md) a [Plugin](./architecture-design/plugin.md) to implement authentication to handle this scenario. - -First, we will use the [key-auth](./plugins/key-auth.md) plugin to create a [Consumer](./architecture-design/consumer.md) `John`. We also need to provide the specified key for `John`. - -```bash -curl "http://127.0.0.1:9080/apisix/admin/consumers" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d ' -{ - "username": "john", - "plugins": { - "key-auth": { - "key": "key-of-john" + "methods": ["GET"], + "host": "example.com", + "uri": "/anything/*", + "upstream": { Review Comment: Yes. You are correct. I missed editing the line I copied. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
