we are using the ASP .Net Zero hosted on Docker Container on Nginx we managed the cors policy and the site works just fine ,However the chat feature and signalR didnot work at all with the following error:
Access to fetch at 'https://xxxxxxxxxxxxx/signalr-chat/negotiate?enc_auth_token=xxxxxxxxxxxxx&negotiateVersion=1' from origin 'https://xxxxxxxxxxxxx' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'.
we tried to use the wild card , in the cors policy like "*.xxxxxxxx.com" and the full URL but all of them didnot work
nginx.config server { server_name frontendApp.xxxx ; include /etc/nginx/conf.d/config/config.conf; location / { proxy_pass http://API.xxxxxxxxxx; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_cache_bypass $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_cache_bypass $http_upgrade; proxy_pass_request_headers on; } location /signalr { proxy_pass http://API.xxxxxxxxxx; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } location /signalr-chat { proxy_pass http://API.xxxxxxxxx; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } include /etc/nginx/conf.d/ssl/ibtik.net-ssl.conf; add_header 'Access-Control-Allow-Origin' 'https://UI.xxxxxx' always; add_header 'Access-Control-Allow-Headers' ''; add_header 'Access-Control-Allow-Methods' ''; }