Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: apisix-dashboard unable to set upstream.pass_host as node when node more than 1 #2155

Closed
leslie-tsang opened this issue Oct 4, 2021 · 0 comments · Fixed by #2168
Closed
Labels
bug Something isn't working checking

Comments

@leslie-tsang
Copy link
Member

Issue description

I found code below in apisix-dashboard make it unable to select Use the domain or IP from Node List in Hostname, Which apisix had supported.

if (
form.getFieldValue('pass_host') === 'node' &&
(form.getFieldValue('nodes') || []).length !== 1
) {
notification.warning({
message: formatMessage({
id: 'component.upstream.other.pass_host-with-multiple-nodes.title',
}),
description: formatMessage({
id: 'component.upstream.other.pass_host-with-multiple-nodes',
}),
});
form.setFieldsValue({ pass_host: 'pass' });
}
return null;

payload below supported by apisix

{
        "uri": "/route-test",
        "name": "route-test",
        "upstream": {
          "pass_host": "node",
          "hash_on": "vars",
          "nodes": {
                "web1:80": 1,
                "web2:80": 1
          },
          "type": "roundrobin",
          "retries": 2,
          "checks": {
              "active": {
                  "timeout": 1,
                  "http_path": "/",
                  "healthy": {
                      "http_statuses": [200, 201, 302],
                      "interval": 1,
                      "successes": 1
                  },
                  "unhealthy": {
                      "http_statuses": [429,404,500,501,502,503,504,505],
                      "interval": 1,
                      "timeout": 1,
                      "http_failures": 1
                  }
              },
              "passive": {
                 "healthy": {
                    "http_statuses": [200, 201, 302],
                    "successes": 1
                 },
                 "unhealthy": {
                    "http_statuses": [429,404,500,501,502,503,504,505],
                    "http_failures": 1,
                    "tcp_failures": 1
                }
              }
          }
    }
}

Expected behavior

apisix-dashboard support upstream.pass_host as node when node list lager than 1

How to Reproduce

  1. Open the apisix-dashboard
  2. Create a new route rule
  3. Define API Backend Server
  4. Add more than 1 node in target list
  5. Change Hostname to Use the domain or IP from Node List
  6. apisix-dashboard will show a alert of When using a host name or IP in the target node list, make sure there is only one target node

Screenshots

No response

Environment

  • apisix version (cmd: apisix version): 2.9
  • OS (cmd: uname -a): Linux localhost 3.10.0-1160.el7.x86_64 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V): 1.19.9.1
  • etcd version, if have (cmd: run etcd --version): 3.4.15
  • apisix-dashboard version, if have: 2.8
  • Browser version, if have: latest Chrome

Additional context

No response

@leslie-tsang leslie-tsang added the bug Something isn't working label Oct 4, 2021
@bzp2010 bzp2010 linked a pull request Oct 13, 2021 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working checking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants