Skip to content

Research on Subdomains #1

Description

@neebs12

Reverse Proxy and WebServer Layer

Nginx allows for wildcards for naming server blocks

*.app.jaricheta.com

This allows all that traffic to hit a specific port regardless of subdomain.

Application Layer

Plain express.js - http://expressjs.com/en/5x/api.html#req.subdomains

// Host: "tobi.ferrets.example.com"
console.dir(req.subdomains) // <--- we can extract the subdomain from url
// => ["ferrets", "tobi"]

With other dependencies, this could simplify the code:
https://www.npmjs.com/package/express-subdomain

//the api middleware flow
router.use(checkUser);
router.use(subdomain('*.v1', v1Routes)); // routing based on subdomain wildcard!
router.use(subdomain('*.v2', v2Routes));

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions