fix: CORS allow * on external (#108)

This commit is contained in:
Neon 2025-12-15 14:29:22 -05:00 committed by GitHub
parent 92eebe783b
commit 54670597cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -1,6 +1,8 @@
module API
module External
class IdentitiesController < ApplicationController
before_action :set_cors_headers, only: %i[check options]
def check
ident = if (public_id = params[:idv_id]).present?
Identity.find_by_public_id(public_id)
@ -30,6 +32,19 @@ module API
result:
}
end
def options = head :ok
private
def set_cors_headers
response.set_header("Access-Control-Allow-Origin", "*")
response.set_header("Access-Control-Allow-Methods", "GET, OPTIONS")
response.set_header(
"Access-Control-Allow-Headers",
"Content-Type, Authorization"
)
end
end
end
end

View file

@ -343,6 +343,7 @@ Rails.application.routes.draw do
end
namespace :external do
get "/check", to: "identities#check"
options "/check", to: "identities#options"
end
end