Fix multiple origins issue
This commit is contained in:
parent
483acde546
commit
f49b947884
@ -134,14 +134,19 @@ impl AppConfig {
|
|||||||
|
|
||||||
/// Get auth cookie domain
|
/// Get auth cookie domain
|
||||||
pub fn cookie_domain(&self) -> Option<String> {
|
pub fn cookie_domain(&self) -> Option<String> {
|
||||||
let domain = self.website_origin.split_once("://")?.1;
|
if cfg!(debug_assertions) {
|
||||||
Some(
|
let domain = self.website_origin.split_once("://")?.1;
|
||||||
domain
|
Some(
|
||||||
.split_once(':')
|
domain
|
||||||
.map(|s| s.0)
|
.split_once(':')
|
||||||
.unwrap_or(domain)
|
.map(|s| s.0)
|
||||||
.to_string(),
|
.unwrap_or(domain)
|
||||||
)
|
.to_string(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
// In release mode, the web app is hosted on the same origin as the API
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get app secret
|
/// Get app secret
|
||||||
|
Loading…
Reference in New Issue
Block a user