diff --git a/app/assets/javascripts/vue-shared.js b/app/assets/javascripts/vue-shared.js index d57ad4f9b..4c8a28979 100644 --- a/app/assets/javascripts/vue-shared.js +++ b/app/assets/javascripts/vue-shared.js @@ -10,7 +10,7 @@ Vue.use(VueResource); Vue.use(EventBus); Vue.use(Alert); -Vue.http.options.root = window.API_ROOT_URL; +Vue.http.options.root = window.API_URL; Vue.http.interceptors.push((_request, next) => { window.$.active = window.$.active || 0; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index acefb9bcb..a12f791ac 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -12,6 +12,14 @@ def app_host request.env["HTTP_HOST"] end + def app_relative_url_root + ENV["RAILS_RELATIVE_URL_ROOT"] || "" + end + + def app_path + File.join(app_host, app_relative_url_root) + end + def js_route action_name = ACTION_ALIASES[controller.action_name] || controller.action_name diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 250bd90bb..fc01a5833 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -29,7 +29,7 @@ html meta content="#205683" name="theme-color" javascript: - window.API_ROOT_URL = '//#{app_host}'; + window.API_URL = '//#{app_path}'; = javascript_include_tag(*webpack_asset_paths("application")) = yield :js_header