UrlHostnameMismatchException errors appear in Jira server logs

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Proxy integration is not part of the Atlassian Support Offering. The instructions provided in this article are for informational purposes only.


The following appears in the atlassian-jira.log:

2012-10-15 08:45:15,089 http-8080-16 ERROR anonymous 525x3869x1 1th4ub5 
XX.XX.XX.XX,127.0.0.1 /plugins/servlet/gadgets/dashboard-diagnostics [dashboard.internal.diagnostics.DiagnosticsServlet] DIAGNOSTICS: FAILED

com.atlassian.gadgets.dashboard.internal.diagnostics.UrlHostnameMismatchException:
Detected URL hostname, 'jira.xyz.company.net', does not match expected hostname, 'localhostname.xyz.company.net'

        at com.atlassian.gadgets.dashboard.internal.diagnostics.Diagnostics.checkExpectedHostname(Diagnostics.java:71)
        at com.atlassian.gadgets.dashboard.internal.diagnostics.Diagnostics.check(Diagnostics.java:32)
        at com.atlassian.gadgets.dashboard.internal.diagnostics.DiagnosticsServlet.executeDiagnostics(DiagnosticsServlet.java:93)
        at com.atlassian.gadgets.dashboard.internal.diagnostics.DiagnosticsServlet.doPost(DiagnosticsServlet.java:61)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52)

Diagnosis

Examine your server.xml and Apache proxy server configurations:

Server.xml :

    <Service name="Catalina">
        <Connector port="8080"
                   	maxThreads="150"
                   	minSpareThreads="25"
                   	maxSpareThreads="75"
                   	connectionTimeout="20000"
                   	enableLookups="false"
                   	maxHttpHeaderSize="8192"
                   	protocol="HTTP/1.1"
                   	useBodyEncodingForURI="true"
                   	redirectPort="8443"
                   	acceptCount="100"
                   	disableUploadTimeout="true"
				 	scheme="https"
 					proxyName="jira.xyz.company.net"
 					proxyPort="443"/>

Apache Configurations:

#FORCE HTTPS
 <VirtualHost *:80>
 	ProxyRequests Off
 	ProxyPreserveHost On
	<Proxy *>
 		Order deny,allow
 		Allow from all
 	</Proxy>
 	RewriteEngine On
 	RewriteCond %{HTTPS} !=on
 	RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
 </VirtualHost>

<VirtualHost XX.XX.XX.XX:443>
 	ServerName jira.xyz.company.net
 	ProxyRequests Off
 	ProxyPreserveHost On
 	
	<Proxy *>
 		Order deny,allow
 		Allow from all
	</Proxy>
 		
		ProxyPass / http://localhost:8080/
 		ProxyPassReverse / http://localhost:8080/
 		SSLEngine On
 		SSLCertificateFile /apps/JIRA/jira.cer
 		SSLCertificateKeyFile /apps/JIRA/jira.key
 		SSLCertificateChainFile /apps/chain.crt
 		
		<Location />
 			Order allow,deny
 			Allow from all
 		</Location>
 </VirtualHost>

Cause

Apache Server does not recognize the ServerName.  In example above, this is 'jira.xyz.company.net'. Another possible root cause could be an incorrect virtual host configuration in the apache reverse proxy, which receives all traffic that does not match to any VirtualHost in the apache configuration.

Resolution

  • There are two solutions:
    1. Change the ServerName to the IP address of the Apache Server

      <VirtualHost XX.XX.XX.XX:443>
       ServerName jira.xyz.company.net
       ProxyRequests Off
    2. Register "jira.xyz.company.net" to the hosts file


      • In Windows.
        • The hosts file is situated at C:\Windows\System32\drivers\etc
      • In Linux
        • The hosts file is situated /etc/hosts
      • Add the following line at the bottom of the file

        <Apache server IP address>  <jira.xyz.company.net >



Last modified on Sep 12, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.