Is it possible to let users have custom domain point to my app with https auto enable for them.

September 6, 2018 688 views
Applications Ubuntu 16.04 Nginx Ruby on Rails

If I want to launch Ruby on Rails website where users can have their dedicated page
1.) as sub domain i.e.
2.) as custom domain i.e.

and also enabled https for both subdomain and custom domain.

Is it possible to do this automatically? Let say once my app get this information from user I run some script to make this happen.

1 Answer

@sarunw you should be able to do something like the following in your nginx configuration:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
  • If I understand correctly that redirect all http to https right? like a force https.

    But I want something like where user can point that custom domain to and enable https (may be via Let’s encrypted) for them.

  • @mwilliamsdev Any security/performance concern with this catch app server_name approach?

Have another answer? Share your knowledge.