On the server side you don't know the scheme used. It isn't part of the request as such. It has to be determined based on the properties of the port that got the request (if you are listening with TLS on a port, the request you got is definitely some flavour of https).
If you have a reverse proxy, or load balancer in front of your app it maybe get passed the scheme in a header (x-forwarded-proto IIRC)