Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

365
Views
Hostname SNI/HTTP mismatch for www.example.com but not example.com

I've had a look at this question, but none of the answers seem to apply. The errors aren't being generated by bots or deliberate attempts to test vulnerabilities - if I enter www.example.com in my browser's address bar (tested on multiple browsers), I will receive a Bad Request error, and the following error will be present in my log for that time:

Hostname example.com provided via SNI and hostname www.example.com provided via HTTP are different

There are also no subdomains that would be causing the underscore issue mentioned in another answer.

I've attempted to add the following lines in my sites-available configuration file in the VirtualHost, but it didn't seem to have any effect:

ServerName example.com
ServerAlias www.example.com

The SSL certificate is from LetsEncrypt, currently valid, and the SANs appear to be correctly listed as www.example.com and example.com.

I've never seen an issue like this before, so I'm not even sure what other information might be relevant to the question.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

if I enter www.example.com in my browser's address bar (tested on multiple browsers), I will receive a Bad Request error, and the following error will be present in my log for that time:

To make things clean, and to follow the general drifting away from www use on the Internet, I use this configuration in Apache, it will cause a redirect back to the https://example.com every time, making that the canonical domain part of the URL, which makes Google Webmaster Tools and Google Analytics happy.

Two virtual host files:

example.com.conf:

<VirtualHost *:80>

    ServerName example.com
    DocumentRoot /var/www/example.com/public

..

www.example.com.conf:

<VirtualHost *:80>
    ServerName www.example.com

    Redirect permanent / https://example.com/
    CustomLog ${APACHE_LOG_DIR}/access_example.log vhost_combined

</VirtualHost>

On Apache to start up the website:

a2ensite example.com
a2ensite www.example.com
service apache2 reload

Install the Let's Encrypt certificates:

letsencrypt --apache -d example.com -d www.example.com

I have been running this configuration for years on 20+ live websites and only see the automatic redirect from the www.example.com to the example.com in the browser, so no errors.

But having said that, I monitor my logs closely and I see this:

Hostname example.com provided via SNI and hostname www.example.com provided via HTTP are different

It will come up randomly at random times on a subset of my websites. It appears to be the noise of the Internet, no real consequence.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!