[Solved] CORS issue
Posted: Mon Nov 26, 2018 6:27 pm
Zoneminder version: 1.32.2 (built from sources)
OS: Linux Gentoo
Web server: Apache
Note: I am aware that building Zoneminder from sources is discouraged, however, the latest version of Zoneminder available for installation in Gentoo portage is 1.30.4 and it is completely unusable with fully updated Linux Gentoo system (it segfaults). https://forums.gentoo.org/viewtopic-t-1084192.html.
So, I obtained sources from github and successfully compiled Zoneminder. It works perfectly fine. There are no problem with build or installation.
The CORS issue I am running into is related to the fact that I am using three different servers to host cameras.
The main server that runs the Web interface
And three servers (in subdomain) to host the cameras:
When I click on the camera (which is hosted by a.example.com) in the console, I can see the stream from the camera, but the event list is empty and the page is constantly refreshing. The developer console is full of Cross-Origin Request Blocked error:
In addition to that there is another error constantly appearing in the console:
The CORS request is coming from example.com to a.example.com and it is as follows:
The web server log lists the failed request with code 200. When I try to visit the failed URL it prompts me with login page. If I login in, it does not solve the problem.
I tried using the config file from https://github.com/ZoneMinder/zoneminde ... -cors.conf but the error still persists (I did adopt config for my installation).
What can be done to solve it?
OS: Linux Gentoo
Web server: Apache
Note: I am aware that building Zoneminder from sources is discouraged, however, the latest version of Zoneminder available for installation in Gentoo portage is 1.30.4 and it is completely unusable with fully updated Linux Gentoo system (it segfaults). https://forums.gentoo.org/viewtopic-t-1084192.html.
So, I obtained sources from github and successfully compiled Zoneminder. It works perfectly fine. There are no problem with build or installation.
The CORS issue I am running into is related to the fact that I am using three different servers to host cameras.
The main server that runs the Web interface
Code: Select all
example.com
Code: Select all
a.example.com
b.example.com
c.example.com
Code: Select all
(Reason: CORS request did not succeed).
Code: Select all
SyntaxError: "JSON.parse: unexpected character at line 1 column 1 of the JSON data"
decode https://example.com/tools/mootools/mootools-core.js:6672:26
success https://example.com/tools/mootools/mootools-core.js:6717:32
wrapper https://example.com/tools/mootools/mootools-core.js:1723:16
onStateChange https://example.com/tools/mootools/mootools-core.js:6291:4
wrapper https://example.com/tools/mootools/mootools-core.js:1723:16
bind https://example.com/tools/mootools/mootools-core.js:993:11
Code: Select all
https://a.example.com/index.php?view=request&request=status&entity=events&id=2&count=20&sort=Id%20desc.
I tried using the config file from https://github.com/ZoneMinder/zoneminde ... -cors.conf but the error still persists (I did adopt config for my installation).
What can be done to solve it?