Hello, I'm trying to use the API but since it is on a different domain than the webapp that is making the javascript Ajax calls I run into CORS (Cross Origin Resource Sharing) errors. So I wanted to set the http response header Access-Control-Allow-Origin that would allow this but after reading your knowledge base it looks like we can't set custom headers.
Is there a way to allow cross-domain sharing with your API?
Thanks, -Don Bragg
Article Comments
I've seen three requests for this so far over the past two years. Is someone there keeping track of the requests---this needs to happen! Would really appreciate it!
Sep, 2015 - Permalink
This article applies to PRTG Network Monitor 15.4.20 or later
Setting Value for Access-Control-Allow-Origin HTTP Response Header
You can define the value for the Access-Control-Allow-Origin HTTP response header with a registry key option as of PRTG version 15.x.20. With this registry hack you can allow any server to send HTTP API requests to PRTG. Please do so only if you are an experienced user!
Steps to Go
Caution: Please back up your system before manipulating the Windows registry!
- Open the registry editor and navigate to the following subkey:
- On a 64-bit Windows system, navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Webserver
- On a 32-bit Windows system, navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Paessler\PRTG Network Monitor\Server\Webserver
- On a 64-bit Windows system, navigate to
- Create a new String:
- In the current subkey, right-click to open the context menu.
- Choose New | String Value
- Name the new value AccessControlAllowOriginHTTPHeader
- Set the value of AccessControlAllowOriginHTTPHeader to the name of the server you want to send API requests from.
- Right-click on AccessControlAllowOriginHTTPHeader
- Select Modify…
- In the value field, enter the server you want to allow to send HTTP API requests to PRTG, for example, http://host_name
- Confirm with Ok.
- Restart the PRTG core server to activate the settings.
With this registry key option you can allow any server to send HTTP API requests to your PRTG server.
Sep, 2015 - Permalink
I have a server that is running (http: host_name1), but I have modified it to the new server (http: host_name2) and it continues to work through (http: host_name1). What can I do wrong?
May, 2018 - Permalink
Hello brunindf, thank you for your reply.
Please note that as described in step4, you need to restart the PRTG core server to activate the settings. Otherwise, please also let me know what exactly isn't working.
Best Regards,
Luciano Lingnau [Paessler Support]
May, 2018 - Permalink
I have already performed all the procedures correctly. Follow header saying that it is released for everything and still does not work.
[0] => HTTP/1.1 200 OK [Connection] => close [Content-Type] => application/json; charset=UTF-8 [Content-Length] => 1025 [Date] => Mon, 07 May 2018 11:23:08 GMT [Expires] => 0 [Cache-Control] => cache, must-revalidate [X-Content-Type-Options] => nosniff [X-XSS-Protection] => 1; mode=block [Access-Control-Allow-Origin] => * [Pragma] => public [Server] => PRTG/17.2.31.2153
May, 2018 - Permalink
Hello brunindf,
thank you for your reply.
You've stated that: "... and still does not work." What exactly does not work? What error are you getting and where?
Best Regards,
Luciano Lingnau [Paessler Support]
May, 2018 - Permalink
Hello Donn,
unfortunately this is not possible/planned at the moment, as described here.
Best Regards,
Aug, 2015 - Permalink