0

I have a RESTful API running on Node which operates on static files that live on the server's disk. If I run the service on Node (via the command line), I am able execute all CRUD operations on my collection of static files, and receive the expected HTTP responses to my HTTP requests.

However, when I take the same service and host it on IIS via iisnode, my GET requests seem to return cached versions of the files. That is, if I edit a file via the REST service, I can remote into the server and confirm that the update was made, but if I request the file via the RESTful API, I receive an old version.

I've tried the following, none of which have worked for me:

  • bouncing IIS.
  • disabling "cache" and "kernel cache" output caching on the web IIS web application.
  • specifying no-cache in the Cache-Control header.
  • removing the configuration for using iisnode's interceptor.

Any ideas on how to prevent iisnode (or iis) from caching my static files would be tremendously appreciated.

GPicazo
  • 6,516
  • 3
  • 21
  • 24

1 Answers1

0

Found a work-around to this issue. The solution was derived by reading through this thread. The solution consisted of:

  • updating my iisnode tag watchedFiles attribute value to reference the static (JSON) files that I wanted to trigger the Node process to restart. Changed from <iisnode watchedFiles="*.js" /> to <iisnode watchedFiles="*.js;relative/path/to/static files/*.json" />
  • Recycle application's app pool. This step is not documented in the thread, and I suspect is the reason others were having problems getting the solution to work.
GPicazo
  • 6,516
  • 3
  • 21
  • 24