1

jsonpを処理できるようにワニスを構成しようとしています。
私はこのソースを基本的な概念として使用します: https://gist.github.com/640331

私はワニス3.0.2を使用しているので、これで終わりまし

サーバーにリクエストを送信した後:

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

私は以下を取得します:

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

の代わりに:

test({...cached-json...});

syslog 出力:

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リクエストを評価する方法は?

4

1 に答える 1

1

解決策を手に入れました! このように見えます。

json 応答に gzip を使用している場合は、jsonp で gzip を有効にすることを忘れないでください。

if ( beresp.http.content-type ~ "application/javascript" ) { 
  set beresp.do_gzip = true;
}
于 2012-06-23T00:07:02.767 に答える