How to intercept request to restApi in Nuxeo

Hi,

Sometimes a call to the rest API returns a broken image like this call, http://dam.nuxeo.server:8080/nuxeo/restAPI/getTiles/default/88cebd21-084e-468c-9388-90bf2b2833f8/600/338/1?x=0&y=0 Although the image is uploaded successfully…
CDN caches the response because the header has 200 status it is not 404 but the image is broken not ready yet may be. So I have to to purge all images on CDN then refresh to get the response with good image and cache the correct one. I thought of having a filter or a servlet before calling the rest api to intercept the respone and check its size, if the size is ridiculously small I would send a response of 404 so my CDN won't cache it.

How would I implement this!! and if there is abetter way to solve my issue it would be great.

Thanks

0 votes

0 answers

1026 views

ANSWER