I have a rails backend server that serves multiple domains with PWA white-labeled applications. We are using capacitor to have native iOS app in the Apple App Store. Everything works until we try to use websockets. I get cors error because origin is prefixed with capacitor:// instead of https://. My cors config looks like:
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins "*"
resource "*",
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head, :connect, :trace]
end
allow do
origins "capacitor://domain.name"
resource "*",
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head, :connect, :trace]
end
end
Second allow here with explicit origin was added as supposed fix but I still get:
Request origin not allowed: capacitor://domain.name
I have a rails backend server that serves multiple domains with PWA white-labeled applications. We are using capacitor to have native iOS app in the Apple App Store. Everything works until we try to use websockets. I get cors error because origin is prefixed with
capacitor://
instead ofhttps://
. My cors config looks like:Second allow here with explicit origin was added as supposed fix but I still get:
Request origin not allowed: capacitor://domain.name