1
我正在使用3scale來管理任何API的前端。我想要在請求的頭部中包含API而不是URL字符串(似乎有點整潔)配置清漆讀取標題
目前它被定義爲這樣。
set req.http.X-3scale-app_id = regsub(req.url,".*[&?](app_id.[^&]*).*","\1");
set req.http.X-3scale-app_key = regsub(req.url,".*[&?](app_key.[^&]*).*","\1");
set req.http.X-3scale-user_key = regsub(req.url,".*[&?](user_key.[^&]*).*","\1");
set req.http.X-3scale-user_id = regsub(req.url,".*[&?](user_id.[^&]*).*","\1");
if (req.http.X-3scale-app_id != req.url) {
set req.http.X-3scale-authrep = req.http.X-3scale-authrep + "&" + req.http.X-3scale-app_id;
}
if (req.http.X-3scale-app_key != req.url) {
set req.http.X-3scale-authrep = req.http.X-3scale-authrep + "&" + req.http.X-3scale-app_key;
}
if (req.http.X-3scale-user_id != req.url) {
set req.http.X-3scale-authrep = req.http.X-3scale-authrep + "&" + req.http.X-3scale-user_id;
}
if (req.http.X-3scale-user_key != req.url) {
set req.http.X-3scale-authrep = req.http.X-3scale-authrep + "&" + req.http.X-3scale-user_key;
}
unset req.http.X-3scale-app_id;
unset req.http.X-3scale-app_key;
unset req.http.X-3scale-user_id;
unset req.http.X-3scale-user_key;
我想什麼做的是採取從標題中的關鍵,因爲我覺得它似乎更好,所以我可以做這樣的事情......
集req.http.X-3比例,APP_KEY = req.http.x-appid
但是我不能得到這個工作!我失去了一些東西
它通過3scale通過api認證。我會嘗試vmod標題。請求應該如何看待客戶端?大概是 –
setRequestHeader – ghloogh