---
title: "tomcat 8.5.31版本开始不支持 域名带下划线 \"_\""
author: "dwangel"
date: "2018-08-10T18:19:17Z"
tags: []
categories: ["编程语言"]
slug: "tomcat-8-5-31"
draft: false
lastmod: "2018-08-10T18:19:17Z"
id: 2428495
url: "https://dwangel.iteye.com/blog/2428495"
---

今天碰到上线的服务，无法访问，只是报 400
查了半天，发现域名里带 下划线 _ 即报400
改成减号（-)就可以正常访问。
查了半天。
原来是 8.5.31 开始严格的host检查……



Enable strict validation of the provided host name and port for all connectors. Requests with invalid host names and/or ports will be rejected with a 400 response. (markt)

<http://tomcat.apache.org/tomcat-8.5-doc/changelog.html>

8.5.32 有相关错误输出，但是碰到 _ 依然会 返回400，即使说了：
 Relax Host validation by removing the requirement that the final component of a FQDN must be alphabetic. (markt)

所以只好降 spring boot内嵌版本。
在maven的pom.xml里设个 <tomcat.version>8.5.30</tomcat.version>