Nothing will stop you, but this isn’t what you want. It’s intended to be an absolute url.
what if the CDN sever provide both http and https. I am not sure which protocol will be use in webpages. How can I set url-prefix proper ?
I’d argue you shouldn’t do that and only access over https. Then use https in your url-prefix.