Filtering localhost requests

We are trying to filter out localhost requests from dev environment, we’ve tried both the localhost server filter and the ignoreUrls option of raven config and still getting localhost requests (JavaScript) coming through, any ideas on what could be an issue?


1 Like

Are you certain they’re from a local IP? (for JS it would be the user.ip_address value).

The request is coming from a public IP, however application is hosted on localhost, which is what we are trying to filter out.

Definitely warrants more discussion. The feature is today intended to prevent local requests from local resources, and it does that by resolving the IP of the user. It’s probably fair to extend it to also look at the ingested URL (from HTTP) and filter out local IPs. There’s some complexity here though, in that we’d probably only want to filter out still.

I also have the exact same issue, I tried to have sentry filter localhost requests from the server side and it did not work.

Then I added ignoreUrls: [/] to ignore it for and it did not work.

The workaround I use is to check myself if it is running on localhost, and, if so, I initialise raven with invalid config so that the request does not reach sentry. But this is a hack and I don’t really like it.

1 Like