HttpParserInvalidURLError: invalid url b'sip:nm'


I’ve started running a few services on Sanic in production, and noticed an error raised by Sentry on many of these services.

The error reffers to a InvalidURLError raised being ‘sip:nm’. I suspect that somehow, a crawler might be sending an invalid HTTP Header causing Sanic to fail with this error, and Sentry to catch that error.

Here’s the error from Sentry, if that can help :

What I’m interested about is two things :

  1. What is happening exactly ? I can’t extract the reason from the log errors.
  2. How to avoid Sanic to throw these errors / or to Sentry to ignore these

I also got other errors that seems to come from Sanic that are unrelated to my code (but probably from a badly written crawler), such as :

InvalidUsage (Bad Request) : Sentry
Another Invalid Url Error : Sentry
RequestTimeout : Sentry (Not much details on this one, but got a lot of these)

Thank you for your input.

These are just standard running-in-production-on-the-internet junk requests. the sip;nm is a SIP request, probing for an open SIP line.

The others are regular junk requests that I see often. Putting your application behind a proxy like nginx or behind a load balancer on a cloud service will block some of this (like the invalid header and opening connections that get terminated without sending an HTTP request thru).

Thanks for your reply.

Do you think it’s something that can be disabled on Sentry level ? (or maybe log or anything)? It pops up as junk in Sentry for something that is neither related to Sanic bug or our own, so it doesn’t have any place on Sentry neither.

Thank you.

You’d need to check the sentry docs on that question.