Set CORS headers for BTCPay API endpoints

This commit is contained in:
Râu Cao 2024-01-02 09:49:09 +03:00
parent 4e566a0607
commit 3aa0c49507
Signed by: raucao
GPG Key ID: 37036C356E56CC51

View File

@ -1,5 +1,6 @@
class Api::BtcpayController < Api::BaseController class Api::BtcpayController < Api::BaseController
before_action :require_feature_enabled before_action :require_feature_enabled
before_action :set_cors_access_control_headers
def onchain_btc_balance def onchain_btc_balance
balance = BtcpayManager::FetchOnchainWalletBalance.call balance = BtcpayManager::FetchOnchainWalletBalance.call
@ -26,4 +27,10 @@ class Api::BtcpayController < Api::BaseController
http_status :not_found and return http_status :not_found and return
end end
end end
def set_cors_access_control_headers
headers['Access-Control-Allow-Origin'] = "*"
headers['Access-Control-Allow-Headers'] = "*"
headers['Access-Control-Allow-Methods'] = "GET"
end
end end