django-anymail: mandrill webhook: incorrect signature with auth

dear, Im getting Mandrill webhook called with incorrect signature error with a Bad Request response towards mandrill.

Sentry logs say about the err location:

filename	
'base.py'
lineno	
216
pathname	
'/home/onlinegv/eggs/Django-1.9.9-py2.7.egg/django/core/handlers/base.py'

I triple checked my webhook and api key. my total settings look like this:

        ANYMAIL =  {
            'MANDRILL_API_KEY': get_config_or_none(
                config,'Email', 'mandrill_api_key', 'SOMEKEY-A'),
            'WEBHOOK_AUTHORIZATION':'SOMEAUTH:SOMEPW',
            'MANDRILL_WEBHOOK_KEY': get_config_or_none(
                config, 'Email', 'mandrill_webhook_key', 'SOMEKEY'),
        }

what else should I check to investigate the failure?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

If your Django app doesn’t know its own public hostname (because Django is behind a proxy that doesn’t set X-Forwarded-Host, e.g.), you’ll need to set MANDRILL_WEBHOOK_URL to the exact webhook url you entered into Mandrill’s dashboard.

Without that setting, Mandrill is computing a signature for something like https://yoursite.example.com/anymail/mandrill/tracking/, but Anymail thinks it was called at something like http://127.0.0.1:8000/anymail/mandrill/tracking/ – so the signatures don’t match.

(I’m making a note to update that error message to include the url Anymail thinks it was called at.)

If that’s not the issue, it would be helpful to know things like Anymail and Django versions, whether the webhook has ever worked (and if so, what changed since then).

You could also scan up the stack trace in Sentry to find where anymail.webhooks.mandrill…validate_request is raising the error – Sentry may have captured more information there that would help your investigation. In particular, signed_data will start with the url Anymail thinks it was called at (followed by your webhook key and the request params that were signed).