Skip to content

Commit

Permalink
feat(redirection): permanent redirection for 1jeune1solution
Browse files Browse the repository at this point in the history
  • Loading branch information
fitchMitch committed Jan 15, 2025
1 parent 7ef7eb5 commit ee2d793
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
helper Turbo::FramesHelper if Rails.env.test?
helper Turbo::StreamsHelper if Rails.env.test?

before_action :check_host_for_redirection
before_action :check_for_holidays_maintenance_page
before_action :check_school_requested
before_action :check_for_maintenance
Expand Down Expand Up @@ -96,6 +97,13 @@ def check_for_holidays_maintenance_page
def maintenance_redirection_exception?
allowed_paths = %w[/maintenance_estivale.html /contact.html /waiting_list]
request.path.in?(allowed_paths) ||
(request.path == "/waiting_list" && request.post?)
(request.path == '/waiting_list' && request.post?)
end

def check_host_for_redirection
return unless request.host == 'stagedeseconde.1jeune1solution.gouv.fr/'

redirect_to ('https://1eleve1stage.education.gouv.fr' + request.fullpath), status: :moved_permanently,

Check warning

Code scanning / CodeQL

URL redirection from remote source Medium

Untrusted URL redirection depends on a
user-provided value
.
allow_other_host: true
end
end

0 comments on commit ee2d793

Please sign in to comment.