This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-06-05 03:09:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-07 11:09:25 -07:00
|
|
|
class Api::V1::StreamingController < Api::BaseController
|
2017-06-05 03:09:29 -07:00
|
|
|
def index
|
2023-02-07 22:07:36 -08:00
|
|
|
if Rails.configuration.x.streaming_api_base_url == request.host
|
2019-10-08 22:10:46 -07:00
|
|
|
not_found
|
2023-02-07 22:07:36 -08:00
|
|
|
else
|
2023-03-25 16:38:32 -07:00
|
|
|
redirect_to streaming_api_url, status: 301, allow_other_host: true
|
2017-06-05 03:09:29 -07:00
|
|
|
end
|
|
|
|
end
|
2019-10-08 22:10:46 -07:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def streaming_api_url
|
|
|
|
Addressable::URI.parse(request.url).tap do |uri|
|
|
|
|
uri.host = Addressable::URI.parse(Rails.configuration.x.streaming_api_base_url).host
|
|
|
|
end.to_s
|
|
|
|
end
|
2017-06-05 03:09:29 -07:00
|
|
|
end
|