Failed CORS: null vs 192.168.1.9, , dns.somesecretname.nl, pi.hole, localhost

The issue I am facing:
Every action performed from the web-UI [ Settings ] page results in a blank page saying;
"Failed CORS: null vs 192.168.1.9, , dns.somesecretname.nl, pi.hole, localhost"
The Tail pihole.log file (live) also does not show anything.

Debug token: https://tricorder.pi-hole.net/rd14m8mkq9

I can however update Gravity lists and enter whitelist domains etc. just fine using the web-gui,
but everything else fails. The blocking works, dnsmasq does what it should do.

Details about my system:
Debian v10
nginx version: nginx/1.19.2
php7.3-fpm

What I have changed since installing Pi-hole:
I tried improving php-fpm config, I tried changing nginx config. To no avail..
I tried debugging php, to no avail.

Any hint on what causes this would be helpful. I'm usually able to solve issues by myself using logs, but logs are not at all helpful in this case.

You aren't running our code as shipped - you have locally modified code.

*** [ DIAGNOSING ]: Web version
[i] Web: v5.1.1 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
[i] Remotes: origin	https://github.com/pi-hole/AdminLTE.git (fetch)
             origin	https://github.com/pi-hole/AdminLTE.git (push)
[i] Branch: master
[i] Commit: v5.1.1-0-ga03d1bd-dirty
[i] Status:  M .gitattributes
             M .github/ISSUE_TEMPLATE.md
             M .github/PULL_REQUEST_TEMPLATE.md
             M .github/workflows/codeql.yml
             M .github/workflows/test.yml
             M .gitignore

In addition, as you noted, you are running nginx which we don't support. You have posted in Community Help and may get some user input here. Others have made nginx work with Pi-hole.

Funny, I have not knowingly modified anything, I used your docs relating to nginx, i.e. I did

service nginx stop && curl -sSL https://install.pi-hole.net | bash

and it failed to install at some point, then I did it again and it worked.
Is there a proper known way to purge uninstall and reinstall it clean then? I can now only find half-done uninstall options in the docs.

By the way, why stick to using your own webserver install, while most systems already use nginx or another webserver? If phpmyadmin and the numerous web-based UIs and weblogs like wordpress etc. can do it, why can't pihole? Is this because of its Raspbery history? Strangely, I have 1 Pi3 running in the house, but that too runs nginx and no lighttpd. Must be me, but I find lighttpd quite cumbersome and overly complex for a webserver config.

It may be your file system doing this. The change was that all of the Pi-hole files had the permissions changed to r/w/e. I don't think this will change the function of our code (but have not tested).

We are moving away from this in a future release (targeted for V6.0). Lighttpd is a legacy that was set up in the early days of Pi-hole and has continued through the current release. Because of our limited developer resources, this is what we support. When we move to the next version of the adminLTE, lighttpd will no longer be used.

Anyone that can tell me what to look for regarding the CORS error?
The other forum entries about it did not solve it for me.

I succeeded in a clean/fresh re-install.
The new debug token is: https://tricorder.pi-hole.net/xzx9ze8s5x
The 'modifications' that I presumably made did not make a difference.
I followed: Redirecting...

Apparently nobody uses this with nginx, php7.3-fpm on debian 10. Color me flabbergasted.

Lots of people do, it's the custom domain name that is the issue.

Edit: Actually, what is the exact error you are seeing, with the exact URL you are calling.

That guide has a chmod 755 for everything, and that's actually a bad thing to do. There's no need to recurse the chmod, if you need to change anything then just change the directory, not every file. There's no need for the contents to be that mode.

That chmod -R seemed strange to me too.
So, the custom domain name, is that in nginx server conf, or the hostname, or what?
I call the admin interface through what I called dns.somesecretname.nl

I just tried putting pi.hole and localhost as aliases in the server_name, to no avail.
Perhaps it's my port 80 to 443 redirect? Going to try some stuff out, now that I may have a lead.

OK, all the above mentioned were not the issue. Now the error I get is this one:

and I can't access the web-UI at all. Strange. It's clearly somewhere in the nginx or php-fpm config.

1 Like

Feel free to edit the NGINX config page, because I have the solution. And it's rather important for all those wanting to use pihole with NGINX.
Bumped into this issue before, with nextcloud. It's related to the position of wide open CORS in the location directive. CORS headers should be set last, or they'll be re-defined using php.
Here's my (example) successful NGINX config for pi-hole, including all the include files and the core nginx.conf:

Note where the include CORS is set in the php location directive.

It's a community created and maintained document. There's a bold header at the top that indicates that.

If you have improvements or changes then you can make them and update the page.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.