Kong没有使用Auth-Key插件加载静态CSS文件

发布于 2025-02-11 03:44:28 字数 893 浏览 1 评论 0原文

我正在使用NGINX建立反向代理,该代理控制对三个Docker容器的访问,该容器中包含我开发的小应用程序。此代理只能由Kong授权的APY-KEY访问键-auth插件。该方案是这样的:

“我的系统的方案”

如果客户端没有API-KEY,请求被拒绝。它似乎在起作用,但是我对静态CSS文件有问题。从浏览器中,我可以访问该应用程序,但是CSS和JS不会加载,因为它们不会在请求中发送API-KEY。因此,当浏览器试图加载样式时,我会得到401 HTTP未经授权的响应:

GET http://localhost:8000/myapp/r2/docs/stylesheets/library.css[HTTP/1.1 401 Unauthorized 1ms]
message "No API key found in request"

因此,我的应用程序正在加载浏览器,没有样式。这些是该应用程序中的样式标题:

  <link href="myapp/r2/docs/stylesheets/library.css" rel="stylesheet" type="text/css">

我如何发送我的API-KEY也加载样式和JS?

I am building a reverse proxy with NGINX that controls the access to a three docker containers which contain a little App I've developed. This proxy can only be accessed by an apy-key authorized by Kong with the key-auth plugin. The scheme is something like this:

Scheme of my system

If the clients don't have the api-key the request is denied. It seems to be working, but I have a problem with the static css files. From the browser I can access the application, but the CSS and JS does not load because they don't send the api-key in the request. For this reason I get a 401 HTTP unauthorized response when the browser tries to load the styles:

GET http://localhost:8000/myapp/r2/docs/stylesheets/library.css[HTTP/1.1 401 Unauthorized 1ms]
message "No API key found in request"

So my app is loading in the browser without styles. These are my style headers in the app:

  <link href="myapp/r2/docs/stylesheets/library.css" rel="stylesheet" type="text/css">

How can I send my api-key to load the styles and js too?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文