What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Using the API getting CORS errors

Votes:

0

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

api cors http prtg reghack response

Created on Aug 7, 2015 9:39:12 PM

Last change on Sep 15, 2015 4:05:00 PM by  Gerald Schoch [Paessler Support]



Best Answer

Accepted Answer

Votes:

1

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!

  1. Open the registry editor and navigate to the following subkey:
    1. On a 64-bit Windows system, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Webserver
    2. On a 32-bit Windows system, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Paessler\PRTG Network Monitor\Server\Webserver
  2. Create a new String:
    1. In the current subkey, right-click to open the context menu.
    2. Choose New | String Value
    3. Name the new value AccessControlAllowOriginHTTPHeader
  3. Set the value of AccessControlAllowOriginHTTPHeader to the name of the server you want to send API requests from.
    1. Right-click on AccessControlAllowOriginHTTPHeader
    2. Select Modify…
    3. In the value field, enter the server you want to allow to send HTTP API requests to PRTG, for example, http://host_name
    4. Confirm with Ok.
  4. 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.

Created on Sep 15, 2015 4:02:52 PM by  Gerald Schoch [Paessler Support]

Last change on Oct 15, 2015 12:49:30 PM by  Gerald Schoch [Paessler Support]



7 Replies

Votes:

0

Hello Donn,
unfortunately this is not possible/planned at the moment, as described here.

Best Regards,

Created on Aug 11, 2015 11:26:24 AM by  Luciano Lingnau [Paessler]



Votes:

0

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!

Created on Sep 14, 2015 12:08:07 AM



Accepted Answer

Votes:

1

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!

  1. Open the registry editor and navigate to the following subkey:
    1. On a 64-bit Windows system, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Webserver
    2. On a 32-bit Windows system, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Paessler\PRTG Network Monitor\Server\Webserver
  2. Create a new String:
    1. In the current subkey, right-click to open the context menu.
    2. Choose New | String Value
    3. Name the new value AccessControlAllowOriginHTTPHeader
  3. Set the value of AccessControlAllowOriginHTTPHeader to the name of the server you want to send API requests from.
    1. Right-click on AccessControlAllowOriginHTTPHeader
    2. Select Modify…
    3. In the value field, enter the server you want to allow to send HTTP API requests to PRTG, for example, http://host_name
    4. Confirm with Ok.
  4. 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.

Created on Sep 15, 2015 4:02:52 PM by  Gerald Schoch [Paessler Support]

Last change on Oct 15, 2015 12:49:30 PM by  Gerald Schoch [Paessler Support]



Votes:

0

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?

Created on May 2, 2018 1:58:41 PM



Votes:

0

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]

Created on May 3, 2018 12:31:18 PM by  Luciano Lingnau [Paessler]



Votes:

0

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

Created on May 7, 2018 11:24:12 AM

Last change on May 7, 2018 11:34:08 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

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]

Created on May 7, 2018 12:29:23 PM by  Luciano Lingnau [Paessler]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.