Proxy Sending

If your application needs to send requests through a proxy you can configure Raygun4JS to point at a different API endpoint. Requests made will then need to be forwarded to the Raygun API.

By default Raygun4JS sends requests to To change this endpoint by using the apiEndpoint option and setting it to a URI which points to your proxy. The URI needs to contain the protocol, domain and (optionally) a port. Payloads will then be sent to this address instead of

rg4js('options', {
  apiEndpoint: '', // Change to your proxy's endpoint 

Raygun4JS sends Crash Reporting error payloads and Real User Monitoring session payloads to the following two endpoints. When configuring your proxy you need to make sure requests made to the following URIs and then forwarded to our API with their headers intact.

Sends error payloads via POST to

Sends session payloads via POST to

Real User Monitoring uses the IP address sent with requests to find the location of your users so you can understand the performance impact. When forwarding information through a proxy this functionality can break as the IP sent will be from your proxy's machine. To maintain this functionality you can either:

When forwarding requests via a proxy onto the Raygun API you can attach a x-forwarded-for header to each payload. This value would be the user's IP address and the Raygun API will then associate these payloads with that IP provided.

If you can't configure the proxy to attach a new header you can use the clientIp option in Raygun4JS to set your user's IP address. This will attach a x-remote-address header to each request associating each payload to the IP provided. See the example below for an example of how this can work:

rg4js('clientIp', ''); // Replace the IP with your user's IP address