-
|
I have a basic hello-world Sinatra app that I'm trying to run with Code: falcon.rb
#!/usr/bin/env -S falcon host
# frozen_string_literal: true
require "falcon/environment/rack"
require "falcon/environment/self_signed_tls"
hostname = File.basename(__dir__)
port = ENV["PORT"] || 9292
service hostname do
include Falcon::Environment::Rack
include Falcon::Environment::SelfSignedTLS
# By default, Falcon uses Etc.nprocessors to set the count, which is likely incorrect on shared hosts like Heroku.
# Review the following for guidance about how to find the right value for your app:
# count ENV.fetch("WEB_CONCURRENCY", 1).to_i
# If using count > 1 you may want to preload your app to reduce memory usage and increase performance:
preload "preload.rb"
endpoint Async::HTTP::Endpoint
.parse("https://localhost:#{port}")
.with(protocol: Async::HTTP::Protocol::HTTP2)
endserver.rb
require "sinatra/base"
class SyncPad < Sinatra::Base
get "/" do
"hello world"
end
endconfig.ru
run SyncPadpreload.rb
require_relative "server"Logs: |
Beta Was this translation helpful? Give feedback.
Answered by
nogweii
Jun 5, 2025
Replies: 1 comment 1 reply
-
|
Oh, searching some more found #75 (comment) which highlights that Here's a diff of my code that works: diff --git a/falcon.rb b/falcon.rb
index bbf4b9a..8ea7a1a 100755
--- a/falcon.rb
+++ b/falcon.rb
@@ -18,7 +18,8 @@ service hostname do
# If using count > 1 you may want to preload your app to reduce memory usage and increase performance:
preload "preload.rb"
- endpoint Async::HTTP::Endpoint
- .parse("https://localhost:#{port}")
- .with(protocol: Async::HTTP::Protocol::HTTP2)
+ endpoint do
+ # Note the use of `ssl_context` here:
+ Async::HTTP::Endpoint.parse("https://localhost:#{port}", ssl_context: ssl_context)
+ end
end |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ioquatix
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, searching some more found #75 (comment) which highlights that
ssl_contextneeds to be passed in. I would've expected it to "just work" with the inclusion of SelfSignedTls.Here's a diff of my code that works: