streaming_controller.rb 483 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. class Api::V1::StreamingController < Api::BaseController
  3. def index
  4. if Rails.configuration.x.streaming_api_base_url == request.host
  5. not_found
  6. else
  7. redirect_to streaming_api_url, status: 301, allow_other_host: true
  8. end
  9. end
  10. private
  11. def streaming_api_url
  12. Addressable::URI.parse(request.url).tap do |uri|
  13. uri.host = Addressable::URI.parse(Rails.configuration.x.streaming_api_base_url).host
  14. end.to_s
  15. end
  16. end