When using Apache for Server Load balancer, it communicates with the Application Server (Tomcat or JBoss) through the AJP protocol. For example, the JBoss configuration is as follows:
<Service name="jboss.web"> <!-- A HTTP/1.1 Connector on port 8080 --> <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" connectionTimeout="20000" redirectPort="8443" /> <!-- A AJP 1.3 Connector on port 8009 --> <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443" /> ......</Service>
Note that the two nodes (HTTP and AJP) do not specify the encoding format, and our pages (JSP or PHP) are usually UTF-8 encoded, such as a JSP page:
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
In this way, if the Link contains Chinese characters (for example, using Chinese as the query string parameter), the Chinese characters will become garbled and cause application errors.
Therefore, if you access the data directly through the application server, you must set the encoding format in the HTTP ctor node:
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
If you are accessing through Apache, you need to set the encoding format in the Connector node of AJP:
<Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443" URIEncoding="UTF-8" />