2012-05-09 2 views
1

jsonp를 처리 할 수 ​​있도록 바니시를 구성하려고합니다. https://gist.github.com/640331광택이있는 jsonp 핸들

나는 그래서 서버에 요청을 보낸 후

with this을 종료 니스 3.0.2을 사용하고 있습니다 : 내가 얻을

curl http://example.com/test?callback=test 


나는 기본 개념으로이 소스를 사용 다음의

test(<esi:include src="http://example.com/test" />); 

Insted :

,691,363
test({...cached-json...}); 

210 시스템 로그 출력 :

The syslog outputs the following: 
May 09 12:48:45 [varnishd] before if for: /JSONP-ESI-TEMPLATE 
May 09 12:48:45 [varnishd] before if for: callback, url: example.com:6081 
May 09 12:48:45 [varnishd] in if for: callback, url: example.com:6081 
May 09 12:52:40 [varnishd] before if for: /JSONP-ESI-TEMPLATE 
May 09 12:52:40 [varnishd] in if for: /JSONP-ESI-TEMPLATE 
May 09 12:52:40 [varnishd] before if for: obj.status == 760 
May 09 12:52:40 [varnishd] in if for: obj.status == 760 
May 09 12:52:40 [varnishd] before if for: beresp.http.X-ESI 
May 09 12:52:40 [varnishd] in if for: beresp.http.X-ESI 
May 09 12:52:40 [varnishd] before if for: beresp.http.X-JSONP-Server 
May 09 12:52:40 [varnishd] in if for: beresp.http.X-JSONP-Server 

어떻게 JSON을 얻을 수있는 ESI 요청을 평가하기 위해?

+0

를 해결나요? – trimbletodd

답변

1

해결책을 얻었습니다! Looks like this. 당신은 당신의 JSON 응답을 GZIP을 사용하는 경우

, JSONP에 대한 GZIP을 가능하게하는 것을 잊지 마세요 : 혹시이

if (beresp.http.content-type ~ "application/javascript") { 
    set beresp.do_gzip = true; 
} 
+0

링크가 끊어진 것처럼 보입니다. 업데이트 된 예제가 있습니까? – mrmagooey

+1

링크를 업데이트했습니다. 다시 작동합니다. – czerasz