OPNsense Forum

English Forums => 24.7, 24.10 Legacy Series => Topic started by: _tribal_ on October 18, 2024, 11:44:12 PM

Title: NGINX allow CORS
Post by: _tribal_ on October 18, 2024, 11:44:12 PM
How to allow CORS when using NGINX ?
I've placed:
    add_header 'Access-Control-Allow-Origin' 'https://xyz.test.top' always;
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
    add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
    add_header 'Access-Control-Allow-Credentials' 'true' always;


directly into the nginx.conf file but it doesn't seem to work. Maybe I'm doing it wrong, in this case I'd like to know how to do it right?
Title: Re: NGINX allow CORS
Post by: Fright on October 19, 2024, 08:14:59 PM
try to use hooks
https://forum.opnsense.org/index.php?topic=27050.msg131201#msg131201
Title: Re: NGINX allow CORS
Post by: _tribal_ on October 21, 2024, 12:42:34 AM
Oh, thanks, and I was wondering where to create the catalog.