How to fix mixed content when using cloudflare ssl?

I am using the latest version of invoiceplane and i am also using cloudflare flexible ssl.
When i activate flexible ssl, it breaks the site. I know wordpress websites have a similar problem but that can be fixed with a plugin. Is there any way to make this work with cloudflare ssl?
Setup: Latest version of invoiceplane
Ubuntu server 14.04 with apache2, php5 and varnish load balancer (latest version from ubuntu repos).
Thank you for your time.