Skip to content

Instantly share code, notes, and snippets.

@pccasto
Last active August 11, 2020 04:02
Show Gist options
  • Save pccasto/176329b389f46970a9d39be90a8a488d to your computer and use it in GitHub Desktop.
Save pccasto/176329b389f46970a9d39be90a8a488d to your computer and use it in GitHub Desktop.
Plugin to set Jekyll/WEBrick to not send Cache-Control header field
# frozen_string_literal: true
# use this with a jekyll site during developement while using `netlify dev` for local testing.
# tested with Jekyll 4.1.1
# plugin needed until this pull request is merged: https://github.com/jekyll/jekyll/pull/8331
#
# this disables Cache-Control header from WEBrick, so that netlify Cache-Control can be set.
# add this file in the site's top-level/_plugins directory.
#
# this will throw a warning about duplicate definition of DEFAULTs, because there are two frozen definitions.
# but the first frozen definition will win.
require 'jekyll/commands/serve/servlet'
module Jekyll
module Commands
class Serve
class Servlet < WEBrick::HTTPServlet::FileHandler
DEFAULTS = {}.freeze
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment