changes.
This commit is contained in:
parent
fb6d7887dc
commit
49b2cc68a5
@ -62,15 +62,14 @@ public class SecurityConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public CorsConfigurationSource corsConfiguration(
|
public CorsConfigurationSource corsConfiguration(
|
||||||
@Value("${application.domain}") String domain,
|
@Value("${application.domain}") String domain
|
||||||
@Value("${application.protocol}") String protocol
|
|
||||||
) {
|
) {
|
||||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||||
corsConfiguration.setAllowedMethods(List.of(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.OPTIONS.name()));
|
corsConfiguration.setAllowedMethods(List.of(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.OPTIONS.name()));
|
||||||
corsConfiguration.setAllowedHeaders(List.of("Authorization", "Content-Type"));
|
corsConfiguration.setAllowedHeaders(List.of("Authorization", "Content-Type"));
|
||||||
corsConfiguration.setAllowCredentials(true);
|
corsConfiguration.setAllowCredentials(true);
|
||||||
corsConfiguration.setMaxAge(Duration.ofDays(1));
|
corsConfiguration.setMaxAge(Duration.ofDays(1));
|
||||||
corsConfiguration.addAllowedOrigin(StringUtils.join(protocol, "://", domain, ":", 443));
|
corsConfiguration.addAllowedOrigin(StringUtils.join("https", "://", domain, ":", 443));
|
||||||
|
|
||||||
if (environment.matchesProfiles("dev")) {
|
if (environment.matchesProfiles("dev")) {
|
||||||
corsConfiguration.addAllowedOrigin("http://localhost:8888");
|
corsConfiguration.addAllowedOrigin("http://localhost:8888");
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import axios, {AxiosError, AxiosRequestConfig} from "axios";
|
|||||||
import {NotificationService} from "../services/NotificationService";
|
import {NotificationService} from "../services/NotificationService";
|
||||||
import {ErrorResponse} from "../models/errorResponse";
|
import {ErrorResponse} from "../models/errorResponse";
|
||||||
|
|
||||||
export const apiUrl = "http://vkr.mskobaro.ru:8080/api/v1/";
|
export const apiUrl = "https://vkr.mskobaro.ru:8080/api/v1/";
|
||||||
|
|
||||||
export const get = async <R>(url: string, data?: any, doReject = true, showError = true) => await request<R>({
|
export const get = async <R>(url: string, data?: any, doReject = true, showError = true) => await request<R>({
|
||||||
url: url,
|
url: url,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user