GET https://127.0.0.1:8443/auth/login net ::ERR_CONNECTION_REFUSED
Также см.:

Это мои конфигурации:
Код: Выделить всё
@Configuration
@EnableWebSecurity
@EnableMethodSecurity
@AllArgsConstructor
@CrossOrigin
@SpringBootApplication(scanBasePackages = {"com.dynamicquotation.dq"})
public class SecurityConfiguration implements WebMvcConfigurer {
private final JwtFilter jwtFilter;
private final DataSource dataSource;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("https://example.com")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.cors(withDefaults()) // Apply CORS configuration
.csrf(AbstractHttpConfigurer::disable);
// Enforce HTTPS
http.requiresChannel(channel -> channel.anyRequest().requiresSecure());
http.sessionManagement(sess -> sess.sessionAuthenticationStrategy(sessionAuthenticationStrategy()));
// Authorization
http.authorizeHttpRequests(auth ->
auth
.requestMatchers("/", "/api/auth/oauth", "/api/auth/user-exists", "/api/user-profile/**").authenticated()
.requestMatchers("/api/auth/**", "/logout", "api/contact", "/api/quotation/single-quotation/**").permitAll()
.anyRequest().authenticated()
);
http.httpBasic(withDefaults());
// logout
http.logout(l -> l
.logoutUrl("/api/logout")
.logoutSuccessUrl("/")
.clearAuthentication(true)
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true)
.logoutRequestMatcher(new AntPathRequestMatcher("/api/logout"))
.logoutSuccessHandler((request, response, authentication) -> response.setStatus(HttpServletResponse.SC_OK))
.addLogoutHandler((request, response, authentication) -> {
// Additional logout handler if needed
}).permitAll());
http.oauth2Login(withDefaults());
http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
Код: Выделить всё
server:
error:
include-message: on-param
tomcat:
max-swallow-size: 50MB
port: 8080
address: 0.0.0.0
Код: Выделить всё
# HTTP server block
server {
listen 80;
server_name api.example.com;
# Redirect all HTTP requests to HTTPS
return 301 https://$host$request_uri;
}
# HTTPS server block
server {
listen 443 ssl;
server_name api.example.com;
# SSL certificate paths
ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;
# CORS headers
add_header Access-Control-Allow-Origin "https://example.com" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
add_header Access-Control-Allow-Credentials "true" always;
location / {
# Handle preflight (OPTIONS) requests
if ($request_method = OPTIONS) {
return 204;
}
# Proxy pass to Spring Boot application
proxy_pass http://127.0.0.1:8080;
}
}
Что вызывает эту ошибку и как ее исправить?
Подробнее здесь: https://stackoverflow.com/questions/790 ... on-refused
Мобильная версия