質問

I've a jsonp RESTful service which delivers content based on certain request parameters. Now, most of these content doesn't change frequently and can be cached easily. Now, we use Akamai edge servers and was hoping to cache a lot of these responses there. But we realized that there's an issue with how the end-client is making the jsonp call. Here's a sample query:


http://localhost:8080/community/service/rest/getContent/jsonp?cb=jQuery18304010053557777724_1391037749519&p=test&v=2015&_=1391037760418 

As you can see,the callback param cb=jQuery18304010053557777724_1391037749519 seems to be auto-generated by jQuery and is unique per request. Also, there's &_=1391037760418 which is being used as cache buster. Now,we can probably set the caching to false. But is there a way to deal with the callback param ? Can we use a static method name ? What'll be the cons if we use a static method and turn of caching ? Will it create any race condition for multiple requests ?

Sorry,for the bunch of questions. I'm not a jQuery person and its not easy for me to troubleshoot the issue. But the caching pretty is important for us.

I'll appreciate if anyone can suggest a solution / best practice to deal with this.

Thanks

役に立ちましたか?

解決

There is nothing you can do on your client or server side that will fix the problem. The callback param cannot be fixed, since the lifetime of the callback must be handled by the client, which may have multiple requests in flight. However a quick google for "Akamai jsonp" resulted in this

This looks to be code to have Akamai cache the json and on request, wrap the json as jsonp dynamically.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top