apisix icon indicating copy to clipboard operation
apisix copied to clipboard

help request: request unauthorized

Open 1renwuruiming opened this issue 3 years ago • 7 comments

Description

当我使用curl进行admin接口调用时返回{"code":4107,"message":"request unauthorized"},确认过参数中的X-API-KEY和配置文件中一致

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

1renwuruiming avatar Jul 21 '22 05:07 1renwuruiming

当我使用curl进行admin接口调用时返回{"code":4107,"message":"request unauthorized"},确认过参数中的X-API-KEY和配置文件中一致

It appears that this response is returned upstream and is not related to APISIX.

tzssangglass avatar Jul 22 '22 03:07 tzssangglass

当我使用curl进行admin接口调用时返回{"code":4107,"message":"request unauthorized"},确认过参数中的X-API-KEY和配置文件中一致

It appears that this response is returned upstream and is not related to APISIX.

image 如图所示,调用admin的接口失败,是什么原因呢

1renwuruiming avatar Jul 22 '22 05:07 1renwuruiming

如图所示,调用admin的接口失败,是什么原因呢

I don't think you are calling the admin API.

You can search for which local service is listening on port 80, because the request is actually sent to port 80.

APISIX doesn't have anything related to 4107.

And you can add -d to curl command, see the response header.

tzssangglass avatar Jul 22 '22 06:07 tzssangglass

通过docker的端口映射,我将9080端口映射到了宿主机的80端口

1renwuruiming avatar Jul 22 '22 06:07 1renwuruiming

image

1renwuruiming avatar Jul 22 '22 06:07 1renwuruiming

image

1renwuruiming avatar Jul 22 '22 09:07 1renwuruiming

Then please give the reproduction steps.

How to start this container and what is the route configuration, and gives the desensitized config.yaml and whether there are custom plugins. This 4107 looks a lot like the one returned by the custom plugin.

And, as a reminder, it is better to use text rather than screenshots, as your screenshots already expose the modified X-API-KEY.

tzssangglass avatar Jul 22 '22 11:07 tzssangglass

This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Jul 14 '23 10:07 github-actions[bot]

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.

github-actions[bot] avatar Jul 29 '23 10:07 github-actions[bot]