A server is running on 5000 port. I have to write a bash script to cURL that URL and parse the response. Here the problem is server can run on either http or https protocol. That means I have curl either https://serverip:5000 or http://serverip:5000.
For now, first I'm checking with http request. If that request fails then I'm checking https. Is there any way that cURL can automatically detect that server running on http or httpsand request to it?
--proto =http,httpsGET /, you can see the redirect. The browser doesn't do it automatically.