Expand my Community achievements bar.

SOLVED

Local dispatcher with DNS name

Avatar

Level 2

I want to test local dispatcher configs with domain names. How can I do this using the docker local/dev dispatcher?

 

Right now I have it standing up but looks like all content can be found using localhost:8080/content/<project>/en.html

Instead I want to do something like this: <random_domain>:8080/en.html

 

This is for local environment setup which allows me to test rewrites and such. Not for use on a web host.

 

1 Accepted Solution

Avatar

Correct answer by
Level 2

You can't add a port to your host file, but when you run a local dispatcher you use the docker_run.sh with port 80 as parameter.

./docker_run.sh [path-to-dispatcher-src] host.docker.internal:4503 80


Your /etc/hosts file should look like this

127.0.0.1 www.mydomain.com

And your VirtualHost should look like this

 

 

<VirtualHost www.mydomain.com:80>
...
</VirtualHost>

 Now you can go to www.mydomain.com in your browser.

 

View solution in original post

4 Replies

Avatar

Employee Advisor

You can do this by making below updates:

Update you local host file with the domain. Something like this - 

127.0.0.1 www.mydomain.com

Add the virtual host config in your dispatcher conf file for www.mydomain.com similar to sample localhost configuration.

Avatar

Level 2

My dispatcher runs on port 8080. I'm assuming I do something like

127.0.0.1:8080 www.mydomain.com

Would my vhost file need to be like be like the following?

<VirtualHost www.mydomain.com:8080>
...
</VirtualHost>

 

Avatar

Employee Advisor

You cannot put the port number in host file. It will only map to your default port 80. You can try running apache server on port 80 or else as an alternate solution follow these:

  1. Install Fiddler2

  2. Navigate to Fiddler2 menu:- Tools > HOSTS.. (Click to select)

  3. Add a line like this:-

    localhost:8080 www.mydomain.com

  4. Save the file & then checkout www.mydomainname.com in browser.

Vhost config in apache looks good. Or for your locl you can just put below one. It will handle all domains on port 8080

<VirtualHost *:8080>
...
</VirtualHost>

 

Avatar

Correct answer by
Level 2

You can't add a port to your host file, but when you run a local dispatcher you use the docker_run.sh with port 80 as parameter.

./docker_run.sh [path-to-dispatcher-src] host.docker.internal:4503 80


Your /etc/hosts file should look like this

127.0.0.1 www.mydomain.com

And your VirtualHost should look like this

 

 

<VirtualHost www.mydomain.com:80>
...
</VirtualHost>

 Now you can go to www.mydomain.com in your browser.