Expand my Community achievements bar.

SOLVED

test Dispatcher locally using production domain

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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