When using an API request from my forum to display posts on an external site, I got this message in the logs. In the configuration file I have the same address that I use for the query. I'm using a reverse proxy, unfortunately I don't know how to add headers
edit 1:
I just added the following NGINX server configuration on the landing page (where the API is used) and on the forum side, unfortunately it didn't work
location /api/ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '$http_origin' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 86400;
return 204;
}
add_header 'Access-Control-Allow-Origin' '$http_origin' always;
proxy_pass https://forum.xxx.it/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}