Hosting using HTTPS and subdomain - https

I am a beginner in website hosting please consider if my question is too silly or this is not the right place to ask this question and direct me to the right place.
I have website (hosted on a subdomain) already running on HTTP (perfectly). I am moving to HTTPS using Let's Encrypt. I have generated the certificate, configured my application and then deployed it using AWS lightsail. I have pointed the domain name using A record, where my lightsail instance IP is pointed by my subdomain.
Problem: When ever I go to my website using the URL https://subdomain.mywebsite.com:80 it works perfectly fine with no privacy error. My HTTPS server listens on port 80. But, if I try any other URL like subdomain.mywebsite.com:80 or subdomain.mywebsite.com I get a privacy error in google chrome saying "Your connection is not private".
I think I am missing some fundamental, which I not able to understand on my own.
My application is nodejs based below is a snippet of my server
const options = {
cert: fs.readFileSync('./sslcert/fullchain.pem'),
key: fs.readFileSync('./sslcert/privkey.pem')
};
app.listen(function () {
console.log("Live");
});
https.createServer(options, app).listen(80, function() {
console.log("From HTTPS");
});

What you need is to redirect all requests to port 80 to port 443, that way browsers apply automatically https protocol.
This means that if someone uses "subdomain.mywebsite.com", it is by default http and port 80, i.e, "http://subdomain.mywebsite.com:80" and you want it to be redirected to "https://subdomain.mywebsite.com", that is listening by default on port 443.And you configure your https service on port 443, which is the standard port for https.
You have two approaches:
Do the redirection in node.js: have a look to this answer for guidance: Automatic HTTPS connection/redirect with node.js/express
Use a proxy to do the redirection:have a look to this blog post for guidance (I am not related to that blog, just did a quick google search): https://serversforhackers.com/c/redirect-http-to-https-nginx
I hope this helps. Provide some comment if you need more clarifications.

Related

Symfony4 - Creating https routes

I am trying to create a route under Symfony4 in https mode. My online research has taught me that I have to present the route in the annotation as follows: #Route ("/lucky", name = "lucky", schemes = {"https"}). But the request made from Chrome gives me the message "This site is inaccessible." Are there any other settings to perform?
I think I found the answer. To accept HTTPS requests, a server must have a certificate. Since this is a local wamp server, wamp must be set to install an SSL certificate. The attached documentation explains how to do:
enter link description here

SSL and Umbraco

I am trying to get SSL working on a Windows server that is hosting our Umbraco sites. We have numerous sites all working within the same Umbraco installation and I have done the binding of the main domain to the SSL certificate on the server and set umbracoUseSSL to true. I have also added the domain with the https part to the culture and hostnames in umbraco.
The above is not working when I type my domain with the https?
My question is since I have not placed a UrlReWrite redirect from http to https is this the reason why I cannot see my website with the https or is it to do with something else?

How do you enable https and http->https redirects in ring / compojure

I am developing a RESTful app, for which I need to redirect requests coming in from an http address to it's https equivalent. I cannot seem to be able to enable https using ring/compojure.
Anyone have some useful tutorials and/or links? I haven't found any.
The documentation doesn't have anything useful either.
Its very simple. If you want to enable HTTPS support in your web app, just do the following:
Generate a Java KeyStore(.jks) file using a linux tool called keytool.
In the ring map of your project.clj file, add the following:
{
:ssl? true
:ssl-port 8443
:keystore "path to the jks file"
:key-password "the keystore password"
}
Fire up the server. Now your web app is HTTPS enabled.
I had a similar problem while I was trying to test my Sign-In using Social Media code which obviously had to authenticate over HTTPS and this did the trick for me.
It's possible to serve HTTPS with clojure, but it's much more popular to put nginx or something like that in front of your ring server. If you can figure out how to configure jetty, though, run-jetty clearly supports SSL.

How do I redirect all https traffic to http in Sinatra on heroku?

I'm trying to redirect all https traffic to http using this in Sinatra
get "*" do
if request.secure?
redirect request.url.gsub(/^https/, "http")
else
pass # continue execution
end
end
However, on a custom domain on heroku, my browser shows me the error:
This is probably not the site you are looking for!
You attempted to reach www.[domain].com, but instead you actually reached a server identifying itself as *.heroku.com.
My DNS is configured with the www subdomain having a CNAME pointing to [domain].herokuapp.com as per https://devcenter.heroku.com/articles/custom-domains
Is this a DNS issue? Is buying a SSL certificate the only way to allow all https traffic to redirect to http, on heroku?
If you were going to use that code then I'd make it a before filter, as that's really what it is.
However, if you've received a request at the application layer (which is where your Sinatra app sits on Heroku) then you need a certificate because the HTTP layer (where the Nginx proxy servers that deal with this sit) has already received the request and will attempt to deal with it as a secure connection but fail/raise an error because there's no certificate. That is the message you'll get if you try and reach an non SSL page/site via the https URI scheme. You can still access the site but the user has to click past a scary warning.
The only way I know of that may work without a certificate (but looking at this answer probably not) is if you had access to the Nginx configuration and did the rewrite of the URL (and probably some headers) there.

get and post request to a https site using vb6.0

Hi i am using MSXML2.ServerXMLHTTP40 to get and post request to a url.When i post to http site it works fine but when i post to https site it throws me an error stating the operation timed out.I am not able to get the response.Kindly help me out.Thanks in advance
I Found the solution I have to set the ..setproxy and setproxycredentials along and also i need to get the session id .When i used all the three it worked fine.
By default HTTP will use port 80 but HTTPS uses port 443. Is it possible that you've got a firewall blocking port 443?
I'd suggest trying to connect to both sites from a webbrowser to make sure it all works.

Resources