I'm going to take a guess and say the relative url assumes http. When you used the full url, you not only changed the protocol from http to https, you also pointed your script to an entirely different url.
....... is an entirely different url than http://mydomain
Yes, you have to point your script to the entirely different url. I don't know if there is another way to do this using only the relative url. Something has to let your script know you want https.