CORS ISSUE NGINX SWAGGER FETCH ERROR SOLUTION – Jeeezzz !

CORS Solution for NGINX SWAGGER

set $origin $http_origin; 

if ($origin !~ '^https?://(docs-mapi)\.4over\.com) {
 set $origin 'https://yourdomain.com';
 }

add_header 'Access-Control-Allow-Origin' "$origin" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, PATCH, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Access Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, api_key' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';