I have a big problem in my website.
Since i moved from Apache webserver to Nginx the ads in my site are not working.
I added these lines in my website config file in nginx:
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Origin,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, HEAD' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Max-Age' '1728000' always;
I did nginx reload but nothing happened.
i tested with curl -X OPTIONS -i https://xy.hu
The answer is:
HTTP/1.1 405 Not Allowed
Server: nginx
Date: Mon, 05 Jul 2021 11:14:07 GMT
Content-Type: text/html
Content-Length: 150
Connection: keep-alive
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-XSS-protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Feature-Policy: autoplay 'none'; camera 'none'
Referrer-Policy: same-origin
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept,Authorization,Origin,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, HEAD
Access-Control-Expose-Headers: Content-Length,Content-Range
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 1728000
<html>
<head><title>405 Not Allowed</title></head>
<body>
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>