Jump to content

NGINX Cors allow origin not match origin

Hey!

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' 'https://xy.hu' always;  (i tried with *, but nothing)
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested -With' 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: Thu, 01 Jul 2021 21:33:48 GMT
Content-Type: text/html
Content-Length: 166
Connection: keep-alive
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Credentials: true

<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>

 

and i tried with an external tester:
HERE

Any idea
s? 🙂


thanks

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×