lesfurets / zeno-pixel

Pixel monitoring tool
GNU Affero General Public License v3.0
41 stars 6 forks source link

DNS-based environments system #7

Closed srobfr closed 8 years ago

srobfr commented 8 years ago

Hello,

First, I would like to thank you for publishing this great tool.

We at VirtualExpo use a DNS-based environments system. All our environments respond on the same domains, without subdomain. The environment currently in use is defined on our dev machines by the DNS resolution of the website domain, so it can be forced by modifying for example the /etc/hosts file on debian machines.

Do you know if zeno-pixel configuration could match this way of defining environments ?

I think it would require to force the Host: HTTP header of every requests issued by PhantomJs/SlimerJS so it match the environment-specific server name, I don't know if PhantomJs provides this feature.

Thank you very much for your answer.

Here is a little example of the kind of configuration we would like to have :

{
    "host" : "www.directindustry.com",
    "envs" : [
        {"alias": "Prod", "server" : "172.25.9.69"},
        {"alias": "Preprod", "server" : "192.168.1.100"},
        {"alias": "Local", "server" : "127.0.0.1"}
    ],
    "desktop" : [
        ...
    ],
    "mobile": [
    ],
    "tablet": [
    ]
}

but this does not seem to work.

CaptainMat commented 8 years ago

hello,

did you try to just change your host by "host" : "{$alias}", without specifying the domain ? phantom will try to acces your pages by using the different ips.

srobfr commented 8 years ago

Thanks for your response. Specifying the IP instead of the domain does not work, because the web server serves multiple virtual hosts and thus looks at the domain in the requested urls.

CaptainMat commented 8 years ago

ok, then you can try to add a custom header to phantomjs in phantomScript.js by using:

page.customHeaders = {
    "Host": "YOUR_HOST"
};

you don't need to restart your app.

srobfr commented 8 years ago

Nice, thank you !