mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 15:29:21 +00:00
Add Access-Control-Allow-Origin Header for admin requests
This commit is contained in:
parent
d141902997
commit
cf5ed7ddde
@ -71,7 +71,7 @@ rtc-relay:
|
|||||||
max-users-per-video-calls: 6
|
max-users-per-video-calls: 6
|
||||||
|
|
||||||
# Admin URL
|
# Admin URL
|
||||||
admin-url: https://console.communiquons.org
|
admin-url: http://localhost:3001
|
||||||
|
|
||||||
# List of #Forez groups
|
# List of #Forez groups
|
||||||
#
|
#
|
||||||
|
@ -13,7 +13,7 @@ use crate::data::base_request_handler::{BaseRequestHandler, RequestValue};
|
|||||||
use crate::data::config::conf;
|
use crate::data::config::conf;
|
||||||
use crate::data::error::{Res, ResultBoxError};
|
use crate::data::error::{Res, ResultBoxError};
|
||||||
use crate::data::user_token::UserAccessToken;
|
use crate::data::user_token::UserAccessToken;
|
||||||
use crate::helpers::{account_helper, api_helper, admin_access_token_helper};
|
use crate::helpers::{account_helper, admin_access_token_helper, api_helper};
|
||||||
use crate::routes::RequestResult;
|
use crate::routes::RequestResult;
|
||||||
|
|
||||||
/// Http request handler
|
/// Http request handler
|
||||||
@ -137,6 +137,11 @@ impl HttpRequestHandler {
|
|||||||
pub fn check_admin_origin(&mut self) -> Res {
|
pub fn check_admin_origin(&mut self) -> Res {
|
||||||
if let Some(header) = self.request.headers().get("Origin") {
|
if let Some(header) = self.request.headers().get("Origin") {
|
||||||
if header.to_str()?.eq(&conf().admin_url) {
|
if header.to_str()?.eq(&conf().admin_url) {
|
||||||
|
self.headers.insert(
|
||||||
|
"Access-Control-Allow-Origin".to_string(),
|
||||||
|
conf().admin_url.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user