1@Override
2 public void addCorsMappings(CorsRegistry registry) {
3 registry.addMapping("/**").allowedOrigins("*")
4 .allowedMethods("GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS")
5 .allowedHeaders("Content-Type", "api_key", "Authorization", "X-Requested-With");
6 }
1MIDDLEWARE = [
2 ...
3 'corsheaders.middleware.CorsMiddleware',
4 'django.middleware.common.CommonMiddleware',
5 ...
6]
7