1

I'm trying to improve the cache capabilities on my sails application.

Sails generate a Etag with its response but when I try to do a GET request with a header 'if-None-Match' containing the Etag from the previous answer I can't get a 304 not Modified response from the server (the response is indeed not Modified and the Etag I receive is the same as the previous one).

I'm using POSTMAN to test the server responses.

Is there a way for a sails server to send such status code on unmodified responses ? I can't find any resource for Etag usage in sails doc.

Thank you.

Ryan Wu
  • 5,963
  • 2
  • 36
  • 47
adc06
  • 793
  • 8
  • 23

1 Answers1

0

Sails.js is based on Express.js and the ETags are generated by Express.js. And according to this answer, weak ETags are generated using CRC32 (source), strong ETags are generated using MD5 (source).

I use DHC - REST/HTTP API Client with If-None-Match header, it works perfect (return 304 Not Modified).

And I found that's because POSTMAN send NO-CACHE header to the server for testing purpose

'cache-control': 'no-cache',

You can follow this answer and turn off this feature then everything will be fine.

Community
  • 1
  • 1
Ryan Wu
  • 5,963
  • 2
  • 36
  • 47