How to deal with "Bad Request (Invalid Hostname)" error?

This article introduces the description, cause, and solution of the "Bad Request (Invalid Hostname)" error when accessing a website created using IIS (Internet Information Services) on a Windows instance.

Problem Description

When accessing a website created using IIS on a Windows instance, a "Bad Request (Invalid Hostname)" error is displayed, as shown in the figure.

Problem Causes

The visited website is not bound to a domain name in IIS or there is a conflict in the domain name bound in IIS to cause this problem.


Note This article uses Windows Server 2019 Data Center Edition 64-bit Chinese version operating system as an example. Other versions of Windows operating systems can be modified by referring to the steps in this article.

1. Remotely connect to the Windows instance.

2. Open IIS.

a. In the lower left corner of the desktop, select the Start icon > Server Manager. open server manager

b. On the Server Manager page, choose Tools > Internet Information Services (IIS) Manager.

Go to the Internet Information Services (IIS) Manager page. Select IIS

3. Right-click the target website in the left navigation bar of the Internet Information Services (IIS) Manager page, and then click Edit Bindings. edit binding

4. On the website binding page, bind the domain name or check whether the bound domain name information is correct.

• Add domain names.

i. On the Site Bindings page, click Add. add domain name

ii. On the Add Website Binding page, set the website domain name information according to the page parameters, and then click OK. Add site binding

• View or modify bound domain names.

i. On the website binding page, double-click the bound website.

ii. On the Edit Website Binding page, view the website information.

If you need to modify the domain name after checking the domain name information, you can directly modify it on the current page, and then click OK. view binding

5. Revisit the website.

The website access is successful, and the problem is solved.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us