Browser requesting for mobile (m.) version of site? - browser

On my webserver I log requests that reach it for domains that are not hosted on the server. I noticed that there are entries that appear to be trying to connect to a mobile version of the site i.e. the domain name in the log is 'm.example.com' instead of 'example.com'
The site itself is fully responsive, and so doesn't need a mobile specific version.
What is the browser expecting to do with any response from m.example.com? And should I be putting anything in the actual site to prevent the browser from attempting this unnecessary request?
For reference, the user-agent of the device that made the request is 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0; ips-agent) Gecko/20100101 Firefox/14.0.1' so it's probably not a search bot.

tl;dr
Just ignore it.
Longer answer
The ips-agent seems to be a bot from VeriSign:
This is Verisigns ips-agent bot. What this does is index your site for verisigns Internet Profile Service. This is something that they use to provide traffic data to prospective buyers of domains that are about to be expired. Verisign is in a unique position of running the .com and .net domain name servers and knows when domains will expire. They are using this information to help sell expiring domains with traffic to bulk domain buyers at registrars such as dynadot.
"Seems to be" because the source I have is not ultimately trustable. Googling "ips-agent" leads to results about VeriSign bot though, so it does seem likely enough.
Another supportive "proof": the source of the source provides a very similar user agent as the one you provided.

In my understanding there's no reason for your Browser to manipulate your URL because the subdomain for your mobileversion could be any subdomain (such as mobile. etc.) But if you don't redirect all subdomains to your mainpage http://page.com your log will show whatever i put in as subdomain.
So you need to configure your webserver accordingly, see below an example for a possible solution as apache configuration
#Standardconfig
<VirtualHost *:80>
ServerName domain.com
ServerAdmin support#domain.com
AddType application/x-httpd-php .php .html .htm .html
ExpiresActive On
ExpiresDefault "access plus 0 seconds"
DocumentRoot /home/www-data/portal
<Directory />
Options FollowSymLinks -MultiViews -Indexes
AllowOverride All
DirectoryIndex index.htm
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
</VirtualHost>
#This part will redirect all subdomains to your page
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias *.domain.com
Redirect permanent / http://domain.co.uk/
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
</VirtualHost>
So it's all just a task for your webserver/loadbalancer

Related

htaccess 301 directive for SSL

I am trying to allow customers to have multiple domains, but 301 them to their "permanent" domain for canonical reasons. I am getting some strange activity, and am positive it has to do with my syntax, however I don't know where the issue resides.
I have a main domain - let's call it permanent_site.com Note: I have an SSL installed and working for "permanent domain"
I have multiple non-permanent domains that I want to permanently redirect to the "permanent domain". Now lets say I have 2 non primary domains: non_p_domain1.com and non_p_domain2.com.
Should this not work?
<VirtualHost *:443>
ServerName non_p_domain1.com
ServerAlias non_p_domain2.com
Redirect 301 / https://permanent_site.com/
</VirtualHost>
<VirtualHost *:443>
ServerName permanent_site.com
DocumentRoot /path/to/html
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCertificateFile /path/to/ssl/permanent_site.com.crt
SSLCertificateKeyFile /path/to//ssl/permanent_site.com.key
SSLCertificateChainFile /path/to/ssl/permanent_site.com.ca.crt
</VirtualHost>
The whole point in doing it this way is to prevent someone from hitting https://non_p_domain1.com and being fed an "unsecure page". Instead, I want them redirected to the permanent domain before they hit the html directory that has all the .htaccess directives.
from hitting https://non_p_domain1.com and being fed an "unsecure page"
All the non-primary domains also need to have an SSL cert installed. By the sounds of it, they don't?
If not, then the client won't (or should not) connect to your server, so they never see the redirect.

Why is my httpd.conf setup routing to https?

I have a number of domains, each one pointing to my server IP..
I've pinged each domain to check the DNS, That's fine, all domains are pointing to the correct server.
All my domains route through the httpd.conf correctly via HTTP, except one domain where for some reason the Http <Virtual: *:80> entry is forwarding to https: (https://preprod.testsite.org.uk) - For security, this isn't the real URL.
Why would this entry fail when the others are fine?
Is there some way of debugging or tracing through the request from the DNS through to the server, through to the httpd.conf?
<VirtualHost *:80>
DocumentRoot "/var/www/html/testsite/production"
ServerName preprod.testsite.org.uk
<Directory /var/www/html/testsite/production>
DirectoryIndex index.php
order allow,deny
allow from all
AllowOverride all
</Directory>
</VirtualHost>
DNS has nothing to do with HTTP to HTTPs redirection.
Test it using curl (-v option) and check if the server is sending a Location to the client telling him to connect over HTTPs.
If curl says there's no redirection to https, might be the application itself telling the client to connect over https OR, maybe, some entry in browser HSTS cache.

WHM/cPanel - Multiple IPs pointing to one root dir

we need our new dedicated IP address (and all future ones) to "point" to the same root directory of our VPS' "parent" domain (main domain with all business logic, where $_SERVER['host'] is detected to connect associated files etc. )
So, for example, domain.net (x.x.x.146) should show content of domain.com (x.x.x.170) etc
We have list of dedicated IPs, added to WHM. We have number of domain names, with those IPS as DNS A records. We have added those domains via cPanel to point to the same public_html..
But all the domains resolve to : cgi-sys/defaultwebpage.cgi with "SORRY! If you are the owner of this website, please contact your hosting provider:" error.
Any suggestions? This is supposed to be quite an easy task, but clearly - not so.
Thank you
Why do you need many IP address? one IP address should be enough for what you want to do.
Indeed HTTP/1.1 protocol is meant for this purpose: many different domains for one IP.
In your VPS you can use for example "Apache" as a Web server with this basic configuration:
ceate/edit on "/etc/apache2/sites-available/" example.com.conf :
<VirtualHost *:80>
DocumentRoot /home/user/pulic_html
ServerName example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
then create/edit example.org.conf:
<VirtualHost *:80>
ServerName example.org
Redirect permanent / http://example.com/
</VirtualHost>
and so on..
then to enable your configuration :
a2ensite example.com.conf example.org.conf
sudo service apache2 restart
If you still want to use many IPs you can install apache in every machine hosting the IP, then redirect to your main site/domain(http://example.com), as shown above. Otherwise, if your hosting provider allow, you can redirect your children domain to your parent domain from your provider website with GUI.
here is the solution. It is not ideal bot it looks like there's not much we can do, having cPanel/WHM installed.
<VirtualHost x.x.x.x:443>
ServerName domain.net
ServerAlias www.domain.net
DocumentRoot /home/user/public_html
#todo common contact mail
ServerAdmin support#domain.net
UseCanonicalName Off
<IfModule mod_suphp.c>
suPHP_UserGroup user user
</IfModule>
<IfModule ssl_module>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domain.net/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.net/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/domain.net/chain.pem
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</IfModule>
<IfModule headers_module>
RequestHeader set X-HTTPS 1
</IfModule>
</VirtualHost>
redirect from 80 to 443 set separately:
RewriteEngine On
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

Cloud Agent, Apache, and drupal's .htaccess

Installed Apache and Cloud Agent.
Agent collects information from mod_status. Everything is ok.
However, when I add drupal files (with .htaccess), Agent can't collect stat anymore.
I already tried many configuration and now I am super confused about VirtualHosts. I used standard agent's configuration for virtualhost:
ExtendedStatus on
<VirtualHost 127.0.0.1:80>
ServerName local-stackdriver-agent.stackdriver.com
<Location /mod_status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
</VirtualHost>
In http.conf I changed only DocumentRoot.
Can someone please explain me why the requests go to drupal's folder, and not to local-stackdriver-agent.stackdriver.com VirtualHost?

Using .htaccess to mask a domain?

So here's the scenario:
The domain I have is www.abc.com and I want to point it to (which belongs to another company).
Question: How would I use .htaccess to forward and mask the url so that it stays as www.abc.com?
In terms of security, is there any point in buying a digital certificate for www.abc.com?
You could uh, run it through a proxy, which will TOTALLY mask it.
You put this in your httpd.conf file, not the .htaccess:
<VirtualHost *:80>
ServerName www.abc.com
ServerAlias abc.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://site-you-want-2-show.com:80/
ProxyPassReverse / http://site-you-want-2-show.com:80/
<Location />
Allow from all
</Location>
</VirtualHost>
You can try with ProxyPreserveHost both On and Off, and testing if the images display properly and the addresses of objects show your domain instead.
WARNING: This is not legal if you do not have explicit permission from the company you are trying to show's website. Perhaps you can then just make your homepage an iFrame.
As for certificates: It can be done, see here: http://ssl-proxy.plz.re (short-url)
.htaccess files cannot "mask" a domain but could use a reverse proxy if the module is installed.
In most case, the "masked" website will refer to full urls and the "mask" will not work for long.
See what #mesh proposed.

Resources