Interesting question. I also happen to be creating an app on Heroku using Instagram, and I hadn't come across the signed header option before, so thanks. (Interestingly it doesn't seem to be easily googleable - the only reference appears to be your question, and something in Russian. I wonder if it's very new?)
Looking at the docs, it seems that it doesn't want the IP of your app itself, but the value of the *client*, which you can access in the X-Forwarded-For header. The StackOverflow question at [1] quotes Heroku's director of security (who also, not coincidentally, happens to be Django's very own Jacob Kaplan-Moss) as stating that Heroku preserves the original client IP and prepends any other values, so it looks as if you can pass in the string available from `request.META['X-FORWARDED-FOR']` directly.
If I've misunderstood that and you do need the IP of the server, it looks like the only way to do that would be to use one of the Heroku add-ons that routes outgoing data through a static proxy. Proximo and QuotaGuard seem to be the options - only QuotaGuard offers a free development option, though.
As regards how to get the value into the request, middleware wouldn't be an appropriate solution here at all. However looking at the repo for the Python instagram client, just yesterday a pull request ([2]) was merged that added in support for exactly this - so you can pass in the IP and your client secret when instantiating the API object.
--
DR.