theodi / uk-postcodes

MIT License
41 stars 17 forks source link

Cached responses for json result in application/octet-stream #39

Closed adnansorg closed 7 years ago

adnansorg commented 10 years ago

For example http://uk-postcodes.com/postcode/SG2 8TN.json returns Headers with

Cache-Control →max-age=0, private, must-revalidate
Connection →keep-alive
Content-Type →application/json; charset=utf-8
Date →Thu, 30 Oct 2014 12:58:13 GMT
ETag →"6003e3e383be8b6cabda98ff09ef3d21"
Server →nginx/1.4.4 + Phusion Passenger 4.0.29
Status →200 OK
Transfer-Encoding →chunked
X-Powered-By →Phusion Passenger 4.0.29
X-Rack-Cache →miss
X-Request-Id →f51aeef4d3f47340d101f9bbffab8dae
X-Runtime →1.159144
X-UA-Compatible →IE=Edge,chrome=1

Subsequent requests for the same endpoint url the headers change to:

Accept-Ranges →bytes
Connection →keep-alive
Content-Length →814
Content-Type →application/octet-stream
Date →Thu, 30 Oct 2014 13:00:27 GMT
ETag →"545235e5-32e"
Last-Modified →Thu, 30 Oct 2014 12:58:13 GMT
Server →nginx/1.4.4
JeniT commented 10 years ago

This is a particular problem given that the CORS headers aren't mirrored in the cached response, which means that once a postcode JSON is cached you can't get it ever again.

romanwozniak commented 9 years ago

Is there any chance to fix it? Or maybe someone knows any workaround? Thanks.

kangarolf commented 9 years ago

I believe I am running into this issue as well.

pezholio commented 9 years ago

Sorry, I missed @JeniT's response to this. I've had a horrible hack to work around this by clearing the cache out, but now I know the underlying issue, I'll try and get it fixed ASAP

kangarolf commented 9 years ago

Cheers..I guess you are working on it right now as its behaving funny.

adnansorg commented 7 years ago

looks solved to me