结合使用Kong的密钥验证和会话插件

问题描述

我是Kong的新手,并且已启用密钥验证插件进行了设置。因此,当我去https://localhost:32443时,我会得到{"message":"No API key found in request"}。如果指定一个apikey,则会得到应用程序的主页,但它为空白。第一个请求以200响应成功https://localhost:32443/?apikey=EMCmOc4oE3KjE3CtCoqqDZ9cBM8mEJWjDcOuPJLXPZCmOJbb-,因为它包含'apikey'。该页面对下载缩小的JS和CSS的所有后续请求均以401失败,因为它们不包含“ apikey”。我已尝试将应用程序配置为使用“会话”插件,但不确定这是正确的选择还是我没有正确配置它。

Request URL: https://localhost:32443/favicon.ico
Request Method: GET
Status Code: 401 
Remote Address: 127.0.0.1:32443
Referrer Policy: no-referrer-when-downgrade
content-length: 41
content-type: application/json; charset=utf-8
date: Sun,06 Sep 2020 07:32:32 GMT
server: kong/2.0.4
status: 401
www-authenticate: Key realm="kong"
x-kong-response-latency: 1
:authority: localhost:32443
:method: GET
:path: /favicon.ico
:scheme: https
accept: image/avif,image/webp,image/apng,image/*,*/*;q=0.8
accept-encoding: gzip,deflate,br
accept-language: en-US,en;q=0.9
cookie: session_2=dhhdjdjdjjd...
referer: https://localhost:32443/?apikey=EMCmOc4oE3KjE3CtCoqqDZ9cBM8mEJWjDcOuPJLXPZCmOJbb
sec-fetch-dest: image
sec-fetch-mode: no-cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,like Gecko) 
Chrome/85.0.4183.83 Safari/537.36

如果我在新选项卡中将'apikey'手动添加到favicon请求中,则可以正常加载。我不确定是否缺少我会自动针对所有请求执行的配置?

非常感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)