Nginx / Laravel multi tenancy SSL management - laravel

Working with a multi tenancy solution where users are to be allowed to set their custom domains - the solution works just fine. However, looking for suggestions on how to get the SSL installed on those custom domains and set them in Nginx so they are served via https route.
In theory, as soon as the user adds custom domain from the backend - SSL is to be installed once A record / CNAME is verified to be pointing correctly. We will be getting Letsencrypt SSL and need an approach on how to handle Ngnix config to provide SSL key to it can be served.
If anyone has produced a similar solution and can shed light on how to approach this, that will be great.
Thanks in advance.

You can solve it by manually issuing certificates using Let's Encrypt and then adding new NGINX config file for serving new domain
Or you can just switch from NGINX to Caddy and it will automatically do it for you! Also you could specify in your application route file a route for a domain whitelist check to prevent unauthenticated domain issues

Related

Subdomain reroute to domain

I have created a web app using Laravel 8 and is hosted on Server A using domain name 'myapp.com'. I have applied a wildcard subdomain eg: 'myweb1.myapp.com' and 'myweb2.myapp.com' for one of the app features.
I then purchased a domain 'myweb1.com' from Server B which I intends to reroute it to 'myweb1.myapp.com'. How do I achieve this?
So, when 'myweb1.myapp.com' is entered the URL will reroute to 'myweb1.com'. And 'myweb1.myapp.com/product' will be 'myweb1.com/product'.
Do I need to change the nameservers for 'myweb1.com'? Do I need to change .htaccess for it? What if I only purchased a domain without a hosting which I can't edit .htaccess? Can I achieve this? And are there any specific term for I want to do?
you can do it with reverse proxy.
if your web server is nginx: https://stackoverflow.com/a/14352958/5987259
if your web server is apache: https://stackoverflow.com/a/52286695/5987259

Strapi:google providers issue

I have a question regarding Providers.
I'm using Strapi in the docker with Nginx reverse proxy and I set up google provider and service.js I added URL: env("", "https://my-link.com/api"),
in the beginning, everything was working fine till I clear the browser cache. Now I'm getting an error
Grant Missing session or misconfigured provider
so when I call /connect/google/callback its fail with 302
On the Strapi website, I found this but not much clear how to debug the issue
Grant: missing session or misconfigured provider: It may be due to many things.
The redirect URL can't be built: Make sure you have set the backend URL in config/server.js: Setting up the server URL
A session/cookie/cache problem: You can try again in a private tab.
The incorrect use of a domain with ngrok: Check your urls and make sure that you use the ngrok URL instead of http://localhost:1337. Don't forget to check the backend url set in the example app at src/config.js.
Thanks in advance.

Why is my Google domain not directing to https?

I deployed an app on Heroku and set up automatic SSL configuration. According to my Heroku, my app can be accessed via https. If I use that URL, the connection is indeed secure.
I added a Synthetic Recored in my google domain to point to this url. I also added a Custom Resource Record where the Name is www, Type is CNAME, and Data is my DNS Target for the app.
I can only connect securely when I use https://www.osrshub.com. If I use www.osrshub.com or osrshub.com, it is not secure. What am I doing wrong?
The comment from user2864740 is correct. I needed to update my front end to redirect to https.
Force SSL/HTTPS with mod_rewrite

How to setup a root domain redirect for https with google domains

Using Google Domains, I've set up a synthetic record to redirect foo.com -> www.foo.com. Just like in this example:
https://support.google.com/domains/answer/6346300?hl=en
However, it doesn't seem to work with https://foo.com.
How do I configure it so that the subdomain forward works with https as well?
To give it more context, I'm mapping my custom domain to a heroku app, so I've set up a CNAME record for www.foo.com, and would like https://foo.com to be mapped to https://www.foo.com
Before providing any input please confirm if you are using any pointing service?
If http://foo.com is working whereas https://foo.com is not then you may need any service like pointDNS or cloudflare.

How to generate a www LetsEncrypt certificate using laravel forge?

I provisioned a server using forge and set the domain to blog.example.com. And I generate a LetsEncrypt certificate for that server and set the site to run on http2. It was perfectly fine.
However, I need to make the server accessible via www.blog.example.com now. So I set a CNAME record to route www.blog to blog.example.com. But I got an error This site can’t provide a secure connection when I try to access the site via www.blog.example.com. So I try to generate a new certificate for www.blog.example.com but forge reply First domain does not match root domain on site.
How can I solve the problem?
Thank you.

Resources