Nuxt.js: How to disable ETag ?

Created on 7 Feb 2018  路  5Comments  路  Source: nuxt/nuxt.js

Hi!

I want to disable etag. I tried:

nuxt.config.js:

  render: {
    etag: false
  },

but it doesn't work.

Thanks in advance,

This question is available on Nuxt.js community (#c2420)

Most helpful comment

Possible indeed. Just set etag option to false in nuxt.config.js

render: {
   etag: false
}

source: https://github.com/nuxt/nuxt.js/blob/72300d350ef6c3087fd1a3d1c4480e4d02932281/lib/core/middleware/nuxt.js#L30

Update:

Locally tested. As the result, it only disables eTag header for SSR responses. For resources served with serve-static including static/* and /_nuxt/* the middleware generates a weak etag using file timestamp by default. (So won't affect perf)

Update 2

Configuration below, will disable it for SSR and _nuxt:

render: {
   etag: false,
   static: {
      etag: false
   }
}

All 5 comments

It seems not currently seem possible.

The only available option in nuxt.config.js is:

render: {
   etag: {
      weak: false
    }
}

see doc: https://nuxtjs.org/api/configuration-render#etag (default: true)
see source code: https://github.com/nuxt/nuxt.js/blob/72300d350ef6c3087fd1a3d1c4480e4d02932281/lib/common/options.js#L323 (default: false)

Possible indeed. Just set etag option to false in nuxt.config.js

render: {
   etag: false
}

source: https://github.com/nuxt/nuxt.js/blob/72300d350ef6c3087fd1a3d1c4480e4d02932281/lib/core/middleware/nuxt.js#L30

Update:

Locally tested. As the result, it only disables eTag header for SSR responses. For resources served with serve-static including static/* and /_nuxt/* the middleware generates a weak etag using file timestamp by default. (So won't affect perf)

Update 2

Configuration below, will disable it for SSR and _nuxt:

render: {
   etag: false,
   static: {
      etag: false
   }
}

@pi0 Thanks. I did some mistake. After second try it works 馃憤

Is it possible to do the same for .js files?

@awronski Yes. See my edited comment. It is only impossible to disable for static/ content. (Which there is no reason to do)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nassimbenkirane picture nassimbenkirane  路  3Comments

vadimsg picture vadimsg  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments