Dynamic cnames for Next.js website on Vercel - javascript

I am trying to add an organisation feature to my existing website, I each organisation to have their own cname for the website, so if the org name is test, the domain for their "code" would be: team.example.com.
Is there a way to automatically setup a cname record and publish a site with set environment variables inside of the code for my website?
I am hosting my website on vercel and have linked the nameservers to it too. My website is written in Next.JS.
I haven't tried anything because I am unsure of a way to do this. My thoughts are that I can make all cname records go to the main domain and then check the router path or something similar to that, I am just checking to see if there is a better way.

Related

How to generate and host node.js app from a pre-made one on a website?

The title maybe a little confusing, so here is what I mean. I have a website where I can allow users to create discord bots, a node.js app basically, but I'm running into a problem. I have the node.js app (bot) saved in a folder on my computer, and for each bot a user creates on the website I want to generate a template of the app and change it's content based on the user's needs which then can be hosted to be online.
I just want to know how I can generate a template for this folder based on the user's needs, how it could be hosted on a service like Heroku, aws, etc., and what are some services/things that could make this process easier.
Here is an illustration to better show what I want to do:
I'm not allowed to embed images, so link it is
I'm not asking for direct steps, just asking for suggestions because I'm kind of lost right now.
If you have a better way of doing this, I would be more than happy to hear about it.
Thanks,
Maybe you can try:
Building a Docker-Image of your Node.js base app
Transfer the changes supplied by the user to a Dockerfile or such
Reference the base image in the Dockerfile as FROM...
Build & Push the images to a container registry
Use the customized images to host them in heroku/kubernetes/swarm etc.

How can http://evilsub.domain.com/linkpage.html exist on a webserver even though my host records for domain.com have no entry for "evilsub"?

Google search console has recently let me know that I have a "Hacked: URL injection" security problem. The error message includes links to the pages. These are in the format:
http://weirdsubdomain.example.com/linkpage.html
I've called this page with curl and wget and the page exists and is returned by the web-server
My site is hosted at https://example.com (note "https")
My site is a static jekyll site that lives on Github Pages
The spam/hacking subdomain pages are "http" (not "https")
My host records on my registrar have no entry for "weirdsubdomain"
I understand I've probably kept an old page with a <script> tag in it that most likely pulls in an old version of jquery or that there could well be some old javascript in there somewhere that allows for taking control of people's browers by introducing javascript into a form input of some similar exploit.
What I don't understand, is how it's possible for someone to get DNS to resolve and route a subdomain of my domain? That seems like a server-side thing?
All advice and info very welcome as I set off to try and clean up or disable my javascript:-)
Update 13 April 2020
I had a look at my host settings and they included records for *.example.com.
My understanding is this wildcard configuration lets another Github user apply a subdomain to my domain. I'm not sure if I've understood this properly but if my registrar has a host record that points *.example to the IP address for Github pages, and I have a CNAME file in the root of my repo with "example.com" then another Github user can place a CNAME in their directory with "subdomain.example.com" and the DNS will route requests accordingly.
Is this true? It seems crazy so prob not true:-)

How can my users create a CNAME record to our site so we can reflect a page created by them?

I work on Authstatus, a product of Authbase. We recently launched and we'd like a way for users to enter their domain into our site, and then point a CNAME record to, for example, status.authbase.co, and for us to route it to their status page.
Currently we use Cloudflare for DNS, and our domain is on the Gandi.NET network. We use a Node JS / Express JS backend.
Any help would be greatly appreciated!
Thanks,
-William

Google APIs - removing auth scope

I'm changing scopes in an app for Google Classroom. I remove from courses .readonly and added student listing
var SCOPES = "https://www.googleapis.com/auth/classroom.courses https://www.googleapis.com/auth/classroom.coursework.students";
I get this error when requesting students even after logging out and attempting to re-authenticate:
Request had insufficient authentication scopes
It seems the token has been cached somewhere.
This Github issue, although for Google Sheets, says the token is in Documents/.credentials/ folder. I don't have this folder though on my Macbook Pro Sierra 10.12.6.
Where can I find that folder and remove the saved scopes so it reauthenticates and accepts my new scopes?
If you change the scopes needed in your application then the user will need to authenticate your application. especially if you go from a read-only scope to a read write scope. This is because you need additional permissions then what you had originally requested. List of google classroom scopes
Assuming that you are using the Google .net client library then you can find the user credentials in the %appdata% folder on your machine. By deleting that fine you can force a authentication. I am guessing that you are since this is the github project you have linked to.
Note: there should be a way of forcing reauth via code but i cant remember the command right now i will have to look it up.

Sharing session between two node apps using SSO

I have an existing website which is built using express and node.js , I have to incorporate nodebb forum in that website which is again a different node application, I am using facebook login for both of them but I have to login into them seperately one by one(using same facebook app for both). What I want to do is,
1.Login via fb or any sso in the main site and the user should be logged in the forum via the same automatically.
2.How can I integrate nodebb in my website so that the look and feel doesn't change, it looks like I am on a completely different website, just need some tips to integrate nodebb in my existing website.
How can I achieve these two?
(Hey there #Vipul, NodeBB dev here) When you establish the express session your app, what are you setting the cookie's domain to?
;domain=domain (e.g., 'example.com', '.example.com' (includes all subdomains), 'subdomain.example.com') If not specified, defaults to the host portion of the current document location.
-- MDN
You'll probably want to set it to .your-domain.com, and likewise for NodeBB (do it in the "Settings/Advanced" section):
Then also make sure the key in your app is set to express.sid, which is the value we use, and that the secrets match.

Categories

Resources