# Custom Domain in Rule

**URL:** <https://community.auth0.com/t/custom-domain-in-rule/58470>\
**Category:** Get Help\
**Created:** [February 24, 2021, 10:11pm UTC](https://community.auth0.com/t/custom-domain-in-rule/58470 "2021-02-24T22:11:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian.renak](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brian.renak/32/12851_2.png) [@brian.renak](https://community.auth0.com/u/brian.renak)\
**Post date:** [February 24, 2021, 10:11pm UTC](https://community.auth0.com/t/custom-domain-in-rule/58470/1 "2021-02-24T22:11:58Z")

</div>

I know we can reference our main domain via auth0.domain within a rule. I cannot find anywhere how to reference the custom domain. Anyone able to point me to the right direction here? I feel like I’m missing something simple…

---

<div class="post-metadata">

**Author:** ![ricardo.batista](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ricardo.batista/32/7711_2.png) [@ricardo.batista](https://community.auth0.com/u/ricardo.batista)\
**Post date:** [February 25, 2021, 10:05am UTC](https://community.auth0.com/t/custom-domain-in-rule/58470/2 "2021-02-25T10:05:25Z")

</div>

Hi @brian.renak

You can find the custom domain in the context object, under context.request.hostname. You can always check what is available in the context object by creating a simple rule as:

function (user, context, callback) {  
console.log(JSON.stringify(context));  
return callback(null, user, context);  
}

And then using the Real-time Webtask Logs extension to check the output:

> **[Real-time Webtask Logs Extension](https://auth0.com/docs/customize/extensions/real-time-webtask-logs)**
>
> Learn how to configure and use the Auth0 Real-time Webtask Logs extension.

---

<div class="post-metadata">

**Author:** ![brian.renak](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/brian.renak/32/12851_2.png) [@brian.renak](https://community.auth0.com/u/brian.renak)\
**Post date:** [February 25, 2021, 1:28pm UTC](https://community.auth0.com/t/custom-domain-in-rule/58470/3 "2021-02-25T13:28:49Z")

</div>

Thanks Ricardo! That did it.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 12, 2021, 1:29pm UTC](https://community.auth0.com/t/custom-domain-in-rule/58470/4 "2021-03-12T13:29:28Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
