Skip to content

Commit

Permalink
Merge pull request #358 from openstax/redirect-fix
Browse files Browse the repository at this point in the history
Fix redirects with other hosts
  • Loading branch information
chrisbendel authored Mar 22, 2024
2 parents 7ad5b55 + 8431012 commit f58f9ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def update

def download_run_results
run = @analysis.runs.find(params[:run_id])
redirect_to url_for(run.output)
redirect_to url_for(run.output, allow_other_host: true)
end

def update_run
Expand Down
7 changes: 5 additions & 2 deletions backend/app/controllers/static_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
class StaticController < ActionController::Base

def catchall
redirect_to local_dev_path_for_request and return unless Rails.env.production?
unless Rails.env.production?
redirect_to(local_dev_path_for_request,
allow_other_host: true) and return
end
render file: 'public/app-root.html' and return if has_auth_cookie?

# see other is treated as signal that target should be canonical
# https://developers.google.com/search/docs/crawling-indexing/301-redirects
redirect_to Rails.application.secrets.homepage_url, status: :see_other
redirect_to(Rails.application.secrets.homepage_url, status: :see_other, allow_other_host: true)
end

def error404
Expand Down

0 comments on commit f58f9ea

Please sign in to comment.