Skip to content

Commit

Permalink
Merge pull request #107 from ThePletch/fix-https-images
Browse files Browse the repository at this point in the history
One more try
  • Loading branch information
ThePletch authored Nov 4, 2023
2 parents 697c197 + ed1bca4 commit 83a483f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
4 changes: 4 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def set_authenticated_user
@authenticated_user = user_or_guest
end

def default_url_options
{ locale: I18n.locale }
end

def permit_additional_user_params
devise_parameter_sanitizer.permit(:account_update, keys: [:name])
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Application < Rails::Application
config.time_zone = "Eastern Time (US & Canada)"
config.active_record.default_timezone = :local
config.active_record.legacy_connection_handling = false
config.force_https_in_route_helpers = false
config.force_https_in_direct_uploads_url = false
config.autoload_paths << Rails.root.join('lib')
end
end
4 changes: 2 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false

# Force route helpers to use HTTPS instead of HTTP by default.
config.force_https_in_route_helpers = true
# Force direct upload URL to use HTTPS instead of HTTP by default.
config.force_https_in_direct_uploads_url = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
Expand Down
5 changes: 3 additions & 2 deletions config/initializers/preload_url_options_override.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ActiveSupport.on_load(:action_controller) do
ActionController::Base.prepend(CoreExtensions::UrlOptionsOverride)
ActionDispatch::Routing::UrlFor.prepend(CoreExtensions::UrlOptionsOverride)
if Rails.application.config.force_https_in_direct_uploads_url
Rails.application.routes.named_routes.get(:rails_direct_uploads).defaults[:protocol] = 'https'
end
end
12 changes: 0 additions & 12 deletions lib/core_extensions/url_options_override.rb

This file was deleted.

0 comments on commit 83a483f

Please sign in to comment.