Blog

ColdBox Free Tip #6 - Using Routing with Wildcard Domains

Victor Campos September 23, 2025

Spread the word

Victor Campos

September 23, 2025

Spread the word


Share your thoughts

102 ColdBox Tips and Tricks by Luis Majano

Domain-Specific Routing with ColdBox!

ColdBox gives you the flexibility to create domain-specific routes, making it perfect for multi-tenant applications or projects that need to respond differently based on the domain or subdomain being accessed. In this tip, we’ll dive into how to use the withDomain() method to create routes that match specific domains or sub-domains.

Domain-Specific Routing

By using ColdBox's withDomain() method in your router, you can define routes that match against incoming domains. This is incredibly useful for multi-tenant applications, where each client has its own subdomain, or any project where domain-based routing is needed.

How to Use withDomain() in Routing

Here’s an example of how you can use domain-based routing in ColdBox:

route( "/" )
  .withDomain( ":client.myapp.io" )
  .to( "client.show" );

In this case, the :client placeholder in the domain will be dynamically filled with the subdomain, and the value will automatically be available in the Request Collection (rc).

For example:

  • Request URLortus.myapp.io
  • rc.clientortus

This makes it easy to handle different client subdomains dynamically in your SaaS or multi-tenant application.

Why Use Domain-Specific Routing?

  • Multi-tenant Support: Perfect for applicatios where each tenant has a unique subdomain.
  • Dynamic Routing: Allows you to dynamically extract domain values and use them in your logic (e.g., to load specific client data).
  • Flexibility: The withDomain() method supports placeholders and wildcards, giving you total control over how domains are routed.

With ColdBox, creating powerful domain-specific routing is a breeze. This feature makes managing multi-tenant apps or subdomain-based routing much simpler. Try it out in your next project!

Learn More ColdBox Tips and Tricks

Stay tuned for more ColdBox tips in our ongoing series. if you want to learn more than 10 free tips and tricks make sure to get your “ColdBox 102 tips and tricks book” We have a variety of formats you can choose from.

Get your Copy

Join the Ortus Community

Be part of the movement shaping the future of web development. Stay connected and receive the latest updates on, product launches, tool updates, promo services and much more.

Subscribe to our newsletter for exclusive content.

Follow Us on Social media and don’t miss any news and updates:

Add Your Comment

Recent Entries

ColdBox 8.1.0 Released — AI Routing, MCP, and BoxLang-First Power! 🚀

ColdBox 8.1.0 Released — AI Routing, MCP, and BoxLang-First Power! 🚀

We are thrilled to announce ColdBox 8.1.0, a targeted minor release packed with powerful new features, important improvements, and critical bug fixes across ColdBox, WireBox, and CacheBox. While minor in version number, this release delivers some truly exciting capabilities — especially for BoxLang developers building AI-powered applications.

Luis Majano
Luis Majano
April 14, 2026
ColdFusion Modernization for UK Universities Without Downtime

ColdFusion Modernization for UK Universities Without Downtime

Across the United Kingdom, many universities still rely on legacy ColdFusion and CFML systems to power student portals, enrollment platforms, research databases, payment gateways, and internal academic workflows.

These systems are often:

  • 15 to 25 years old
  • Mission-critical
  • Deeply integrated with student information systems
  • Running on older Adobe ColdFusion or Lucee versions
  • Tightly coupled monolithi...

Cristobal Escobar
Cristobal Escobar
April 13, 2026
BoxLang AI Series: Complete Guide to Building AI Agents

BoxLang AI Series: Complete Guide to Building AI Agents

The world of AI development is moving fast, but building real, production-ready AI agents doesn’t have to be complex.

This series walks you step by step through how to design, build, and deploy AI agents using BoxLang AI. Whether you’re exploring AI for the first time or looking to modernize your current applications, these guides will help you move from concept to implementation with clarity.


Start Here: A Practical Overview

If you’re new to BoxLang AI or want t...

Cristobal Escobar
Cristobal Escobar
April 13, 2026