What's your current setup? An HTTP Virtual Server and an HTTPS Virtual Server? I assume you have a redirect iRule on the HTTP Virtual Server?
Here's a "complete setup."
1. Virtual Server configured for the IP to which mydomain.com resolves listening on port 80. This virtual Server also has an iRule to handle the mydomain.com > https://www.mydomain.com redirect.
2. Virtual Server configured for the IP to which mydomain.com resolves listening on port 443. This Virtual Server must also be terminating the SSL connection so it can see the client request and redirect it. This Virtual Server also should have an iRule similar to the one for HTTP.