Reputation: 451
I am building a React Native app which currently uses port 3000 on a server to make Mongoose requests and more, like the below
http://<aws-ip-address>.compute.amazonaws.com:3000
If I'm not mistaken I have to use https, not sure if it was an Apple or Firebase requirement.
If I use something like
https://<aws-ip-address>.compute.amazonaws.com:443
Would that be valid? You are already specifying the 'https' part and then with the port you do it again? Does one override the other (e.g. in the case of https://.compute.amazonaws.com:5000 is it https or not, because it says 'https' but port is 5000)? Same question for 'http' and port 80
Upvotes: 0
Views: 2116
Reputation: 61892
For simplicity sake let's say that a URL looks like this:
scheme://fqdn:port/
The scheme (http or https) is independent of the port, but both http and https have default ports associated with them. You need both a scheme and a port to make a connection.
http://fqdn/
is equivalent to http://fqdn:80/
and
https://fqdn/
is equivalent to https://fqdn:443/
Nowadays the browser defaults to http but some browsers will default to https when the scheme is omitted.
When entering fqdn:443/
the browser will try to open http://fqdn:443/
(for now but the default behavior is changing with different browser makers), but only if there is no HSTS record in the browsers cache for that fqdn.
When entering https://fqdn:80/
the browser will use https as is defined and connect to TCP port 80. Of course, the server must be configured for TLS on that port and have a web server that speaks the http protocol behind that.
Upvotes: 4