Score:0

stop mail.domain.com from browser

ru flag

I have a mail server setup for a domain using postfix. For the ssl cert, I have created a virtual host for that mail server. The virtual host look like this

<VirtualHost *:80>
  ServerName mail.domainX.net
  DocumentRoot /var/www/roundcube/

  ErrorLog ${APACHE_LOG_DIR}/mail.domainX.net_error.log
  CustomLog ${APACHE_LOG_DIR}/mail.domainX.net_access.log combined

  <Directory />
    Options FollowSymLinks
    AllowOverride All
  </Directory>

  <Directory /var/www/roundcube/>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =mail.domainX.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

My problem is when I hit mail.domain.com in the browser it opens the webpage for another domain set up on my server using apache virtual host. How can I stop this from the browser?

Thanks in advance.

in flag
Is the configuration file really loaded? Did you restart or reload the apache process after editing the configuration file? Is the domain used in another configuration file?
ru flag
yes, its loaded, I have restarted as well. What do you mean by domain used in another config ?
cn flag
Bob
You have there a plain HTTP virtual host that is configured with a permanent redirect to the corresponding HTTPS URL. If there is no HTTPS / SSL VirtualHost for mail.domainX.net configured (but the servers SSL certificate does include that hostname and you don't get an certificate warning) the default virtual host for HTTPS / SSL / TLS requests will be used by Apache.
ru flag
so should I remove this line ? '''RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]'''
cn flag
Bob
That and clear your bowser cache (permanent redirects are cached) OR set up a SSL virtual host for for mail.domainX.net
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.