diff --git a/lib/better_errors/editor.rb b/lib/better_errors/editor.rb index b8de8fb7..96ffc3f0 100644 --- a/lib/better_errors/editor.rb +++ b/lib/better_errors/editor.rb @@ -84,6 +84,10 @@ def url(raw_path, line) url_proc.call(file, line) end + def scheme + url('/fake', 42).sub(/:.*/, ':') + end + private attr_reader :url_proc diff --git a/lib/better_errors/middleware.rb b/lib/better_errors/middleware.rb index 4a097297..7a2ebbeb 100644 --- a/lib/better_errors/middleware.rb +++ b/lib/better_errors/middleware.rb @@ -122,6 +122,7 @@ def show_error_page(env, exception=nil) # Inline style is required by the syntax highlighter. "style-src 'self' 'unsafe-inline'", "connect-src 'self'", + "navigate-to 'self' #{BetterErrors.editor.scheme}", ].join('; '), }