How to redirect http to https on digital ocean droplet?

AI-generated summary

The discussion is about redirecting http and www to https on a Digital Ocean droplet running Discourse. asugar initially asked for help with the redirection, and maiki requested clarification on the specific redirects needed. asugar specified the desired redirects: http://www.mydomain.com to https://mydomain.com and www.mydomain.com to https://mydomain.com.

pfaffman suggested using forcewww.com to redirect the apex domain to www, and noted that the http to https redirect on www already works. However, a more complicated solution using Let’s Encrypt with multiple domains is also possible, but the current directions are outdated.

asugar expressed uncertainty about the underlying web server used by Discourse (nginx or Apache) and asked if it’s possible to redirect subdomains from a configuration file.

Hello All,
I’ve installed discourse via digital ocean droplet. I want to redirect www and http to https how to do it?
I did search a lot but couldn’t find a solution. Most of the posts on this topic are talking about SSL.
Any help?
Thanks

Hiya. :wave:

Let’s clarify what are are asking:

  • www is a sub-domain
  • http and https are protocols

They are definitely related, but it’s hard to tell what you need done. If you can’t use a domain, you can use example.org, so for instance, you might say:

I’m trying to redirect http://www.example.org to https://forums.example.org

Depending on what needs to be redirected, it may be a Discourse configuration, a web server setting, or something at your domain registrar, hence why we need more details. :slight_smile:

I want to redirect followings

http://www.mydomain.com to https://mydomain.com
www.mydomain.com to https://mydomain.com

You can use forcewww.com to make your apex domain redirect to www. The http → https on www works already.

A more complicated way, that I don’t currently know how to accomplish is Set up Let’s Encrypt with multiple domains (the old directions seem not to work now), so I recommend useing forcewww.com.

I intend to figure out how to solve the problem with the multiple-domaim solution, but too much other paying work is in the way.

Thanks for the reply.
I’m new to docker/discourse/RoR so not sure what exactly it uses underneath?
What does discourse use as web server? nginx or apache? Can’t we redirect subdomain from any config file?