Skip to content

Instantly share code, notes, and snippets.

@fnordfish
Created September 27, 2023 12:58
Show Gist options
  • Save fnordfish/ed62e6875bf9a74360fe417becd2a29d to your computer and use it in GitHub Desktop.
Save fnordfish/ed62e6875bf9a74360fe417becd2a29d to your computer and use it in GitHub Desktop.
Start a static file server with self signed tls using ruby and falcon
#!/usr/bin/env falcon serve --hybrid -c
# frozen_string_literal: true
# Adapted from
# https://github.com/socketry/falcon/blob/9170a2a59c360945837f5c993e5684bce63b0672/examples/hello/config.ru
#
# * `gem install falcon`
# * This file needs to be named `.ru`, otherwise it won't be loaded as a rackup file.
# For a less verbose console
# Console.logger.level = :warn
root = Dir.pwd
use Rack::Static, urls: ["/"], root: root, index: "index.html", cascade: true, header_rules: [
[:all, { "Cache-Control" => "no-cache" }],
]
run Rack::Files.new(root, { "Cache-Control" => "no-cache" })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment