Solved it!
in case anybody else runs into this problem I found the solution here: [HELP] Cannot login, error shows "BAD CSRF"
I added this:
RequestHeader set X-Forwarded-Proto "https"
to the vhost config for the ssl site so the X-Forwarded-Proto
header will be passed on to Discourse.