enable CORS on web - allowing to connect by client app

This commit is contained in:
Nuwan Chathuranga 2021-07-22 17:19:40 +05:30 committed by Nuwan
parent ec8a481b42
commit f57218f429
5 changed files with 20 additions and 1 deletions

View File

@ -157,6 +157,8 @@ gem 'elasticsearch'
gem 'logging', '1.7.2'
gem 'rack-cors'
if ENV['FASTER_PATH'] == '1'
# https://github.com/danielpclark/faster_path

View File

@ -512,5 +512,7 @@ if defined?(Bundler)
config.latency_data_host = "http://localhost:4001"
config.latency_data_host_auth_code = "c2VydmVyOnBhc3N3b3Jk"
config.manual_override_installer_ends_with = "JamKazam-1.0.3776.dmg"
config.spa_origin = "http://beta.jamkazam.local:3000"
config.session_cookie_domain = ".jamkazam.local"
end
end

View File

@ -116,4 +116,8 @@ SampleApp::Application.configure do
config.use_video_conferencing_server = true
config.latency_data_host = "http://localhost:4001/local"
config.latency_data_host_auth_code = "c2VydmVyOnBhc3N3b3Jk"
config.spa_origin = "http://beta.jamkazam.local:3000"
config.session_cookie_domain = ".jamkazam.local"
end

View File

@ -0,0 +1,10 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins Rails.configuration.spa_origin
resource '*',
headers: :any,
methods: [:get, :post, :options],
credentials: true
end
end

View File

@ -1,6 +1,7 @@
# Be sure to restart your server when you modify this file.
SampleApp::Application.config.session_store :cookie_store, key: '_jamkazam_session'
domain = Rails.env.production? ? ".jamkazam.com" : ".jamkazam.local"
SampleApp::Application.config.session_store :cookie_store, key: '_jamkazam_session', domain: domain
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information