I have tried this myself, but it seems that MixPanel supports providing a custom host for API calls, https://github.com/mixpanel/mixpanel-js/blob/8b2e1f7b/src/mixpanel-core.js#L87-L110. That would simplify (and probably make more robust) your proxy.