2012-08-23 2 views
1

3scale을 사용하여 API의 프론트 엔드를 관리하고 있습니다. URL 문자열 대신 요청의 헤더에 API를 포함하려고합니다. 조금 깔끔하게 보입니다.바니시로 헤더를 읽도록 설정하기

현재로서는 정의되어 있습니다.

세트 req.http.X-3scale-app_key ... 내가하고 싶은 무엇

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-appid

그러나 나는 이것을 작동시킬 수 없다! 내가 뭔가

를 놓친 거지

답변

0
당신은 일반 텍스트

에 SomeOtherHeader을 설정해야합니다 클라이언트 측에이

set req.X-3scale-app_id = header.get(req.http.SomeOtherHeader,".*"); 

처럼 뭔가 VMOD header에서 방법을 얻을 사용하려고 할 수 있습니다

그런데 왜이 X-를 설정하지 3scale-app_id를 클라이언트 측에서 직접?

+0

API를 통해 3 단계 인증을 통과합니다. 나는 vmod 헤더를 시도 할 것이다. 요청이 클라이언트 쪽에서 어떻게 보이게해야합니까? 아마도 –

+0

setRequestHeader 일 것입니다. – ghloogh

관련 문제