Fix for when you are using ssl in front
Found the real reason for the bug I made a workaround for.. Everything works now