Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1493

Sring Boot. Failed to fetch. Possible Reasons: CORS Network Failure URL scheme must be "http" or "https" for CORS request

$
0
0

when i try swagger on my local host the app works correctly(the api works), but i have done a deploy on railway and when i try to test an API from the swagger i get this error:

Failed to fetch.Possible Reasons:CORSNetwork FailureURL scheme must be "http" or "https" for CORS request.

I think it occur cause in the local app i do a request with a http link but in deploy version on railway it automaticaly was set to https, can this cause the erorr ?

I try to add to my application a WebConfig :

@Configurationpublic class WebConfig implements WebMvcConfigurer {    @Override    public void addCorsMappings(CorsRegistry registry) {        registry.addMapping("/**")                .allowedOrigins("*")                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")                .allowedHeaders("*");    }}

But this didn't help i still get the same error

!!!!! When i make a request from the postman i get a right response with this link(this is a get request): https://exciting-wonder-production.up.railway.app/country, but from the swagger i get the error :
Failed to fetch.Possible Reasons:CORSNetwork FailureURL scheme must be "http" or "https" for CORS request.


Viewing all articles
Browse latest Browse all 1493

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>