Knowledgebase

How to Configure CORS Headers Properly in Nginx Print

  • 0

Allow your frontend domain to communicate securely with your API subdomain.

Step-by-Step Instructions

  1. Add Access-Control-Allow-Origin headers in your API server block.
  2. Handle OPTIONS preflight requests with HTTP 204.
add_header 'Access-Control-Allow-Origin' 'https://yourdomain.pk' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;

Pro Tip: Restrict origins to your exact domain rather than * when sending cookies/credentials.

Need assistance? Open a ticket in the A1 Client Area or contact our 24/7 NOC Engineering Team on WhatsApp at +1 (406) 229-9597.


Was this answer helpful?

« Back