ph-enable-cors (#210)
permitted HTTP methods explicitly given Co-authored-by: Peter Hormanns <peter.hormanns@jalin.de> Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/210 Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net> Co-authored-by: Peter Hormanns <peter.hormanns@hostsharing.net> Co-committed-by: Peter Hormanns <peter.hormanns@hostsharing.net>
This commit is contained in:
committed by
Timotheus Pokorra
parent
d282885cc9
commit
865830071e
@@ -24,9 +24,11 @@ public class HsadminNgApplication {
|
|||||||
// TODO: to enable testing, we should use Spring config
|
// TODO: to enable testing, we should use Spring config
|
||||||
String allowedOrigins = System.getenv("ALLOWED_ORIGINS");
|
String allowedOrigins = System.getenv("ALLOWED_ORIGINS");
|
||||||
if (allowedOrigins == null || allowedOrigins.length() <= 1) {
|
if (allowedOrigins == null || allowedOrigins.length() <= 1) {
|
||||||
allowedOrigins = "*";
|
allowedOrigins = "/**";
|
||||||
}
|
}
|
||||||
registry.addMapping("/api/**").allowedOrigins(allowedOrigins);
|
registry.addMapping("/api/**")
|
||||||
|
.allowedOrigins(allowedOrigins)
|
||||||
|
.allowedMethods("GET", "PUT", "POST", "PATCH", "DELETE");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user