I have noticed a number of posts about this, however nothing really up-to-date.
What I am attempting to do is access the PRTG API from a client script (JavaScript) within a basic HTML5 website. This is however hampered by HTTP access control (CORS). Specifically the absence of the following response headers:
- Access-Control-Allow-Origin
- Access-Control-Allow-Methods
- Access-Control-Allow-Header
Is there a way, either via the web interface or via manually editing a config file on the PRTG server to add custom response headers to PRTG?
This would allow users to add the necessary response headers and enable CORS for their PRTG instance, thus allowing cross origin resource sharing.
The other possibility that has been previously raised is to use JSONP. However this is not truly viable due to strict MIME type checking in Google Chrome.
Refused to execute script from 'https://...' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
JSONP seems to work Ok in Firefox 35.0.1 but is buggy in IE 11.0.19 and fails in Google Chrome 43.0.2357.71
At the moment the only option I am left with is writing my own custom web api proxy, which while totally achievable somewhat time consuming...
What would potentially be useful for a future version of PRTG would be the ability to add/remove customer response headers from the System Administration area.
Add comment