test Dispatcher locally using production domain | Community
Skip to main content
Level 3
December 16, 2023
Solved

test Dispatcher locally using production domain

  • December 16, 2023
  • 1 reply
  • 877 views

Hi,

 

I am developing AEM as Cloud Service locally on my MacOS, and I have a dispatcher with the following rule in the `rewrite.rules` file:

 

 

RewriteCond "%{HTTP_HOST}" "^example\.website\.ca" [NC] RewriteRule ^/?$ /content/path/en.html [PT,L]

 

 

As you can see, the condition check if the domain is "example.website.ca", before applying the rule. 

 

However, "example.website.ca" is my production domain, so I can't really test if my rule is working or not, without deploying my code to AEM Cloud.

 

I am wondering if there is a way to test the dispatcher locally, while passing in the domain "example.website.ca" to the dispatcher?

 

I tried mapping "example.website.ca" to my "localhost:80" in my system's "/etc/hosts" file mapping, but the dispatcher still seems to see the domain as "localhost" when I visit "example.website.ca" in the browser.

 

Thank you

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Preetpal_Bindra

Hello @sean12341 ,

There is a Chrome plugin that I'm trying to remember that could do this kind of stuff, where it simulates the requests on a developer machine and sets the production domain to it.

 

Meanwhile is this something that works for you?

 

<VirtualHost *:80>
    ServerName yourfakedomain.com
    DocumentRoot "/var/www/html/"
    <Directory /var/www/html/>
    Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

 

thanks,

Preetpal

1 reply

Preetpal_Bindra
Community Advisor
Preetpal_BindraCommunity AdvisorAccepted solution
Community Advisor
December 16, 2023

Hello @sean12341 ,

There is a Chrome plugin that I'm trying to remember that could do this kind of stuff, where it simulates the requests on a developer machine and sets the production domain to it.

 

Meanwhile is this something that works for you?

 

<VirtualHost *:80>
    ServerName yourfakedomain.com
    DocumentRoot "/var/www/html/"
    <Directory /var/www/html/>
    Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

 

thanks,

Preetpal

Preetpal_Bindra
Community Advisor
Community Advisor
December 16, 2023