Learn about Centmin Mod LEMP Stack today
Become a Member

How can I enable CORS for Nginx?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, May 9, 2017.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    4:09 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed:1.13.0
    • PHP Version Installed: 7.0.18
    • MariaDB MySQL Version Installed: 10.1.23
    • When was last time updated Centmin Mod code base ? : just now



    Hello :)

    How can I enable CORS for Nginx?

    https://enable-cors.org/server_nginx.html

    Do I need to recompile?
    What parameters to use?
    Any way to make it persistent?

    Can that cause any issues related to Let's Encrypt?

    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    54,907
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    12:09 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    no CORS is purely nginx header configuration you need to figure out and yes it can cause issues if misconfigured

    you're on your own configuring CORS headers, read https://enable-cors.org/resources.html

    Using CORS - HTML5 Rocks