I am facing below issue while integrating front end code with back end in test server.
Access to fetch at 'https://jdapi-dev.xxxx.tech/api/v1/userManagement/jdUser/JD2343/active' from origin 'https://jdfront-test.heptagon.tech' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status. polyfills.52acc7235a996477c95c.js:1 PUT https://jdapi-dev.xxxxx.tech/api/v1/userManagement/jdUser/JD2343/active 504 (Gateway Timeout)
Below are the steps I tried to fix the issue
- allow cors in the controller level
- allow globally
- allow cors with '*'
- allow cors with localhost and test server domain
- removed all other securities
- Server team did some configuration in nginx side
- Previously I was able to replicate in local, but now it is working in local but still issue in test
Below is the configuration that I am using
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("*").allowedMethods("PUT", "GET", "DELETE", "OPTIONS", "PATCH","POST");
}
}
Can someone help me for this issue?
Thanks,