You could capture the scheme by using the {SERVER_PROTOCOL} server variable in condition. This server variable contains the protocol together with version number (e.g. HTTP/1.1), so you would need to have a regex that captures only the protocol part. For example:
<add input="{SERVER_PROTOCOL}" pattern="^(HTTPS?)"/>
then use this in your substitution URL: {C:1}://yourservername.com