Nginx开启HTTPS反向代理访问Jira失败

使用的Jira 版本:v7.1.1,之前一直是http访问,在买完证书,部署好https访问时,界面一直在提醒:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
We've detected a potential problem with JIRA's Dashboard configuration that your administrator can correct. Click here to learn more

We've detected a potential problem with JIRA's Dashboard configuration that your administrator can correct. Hide
Dashboard Diagnostics: Mismatched URL Scheme

JIRA is reporting that it is using the URL scheme 'http', which does not match the scheme used to run these diagnostics, 'https'. This is known to cause JIRA to construct URLs using an incorrect hostname, which will result in errors in the dashboard, among other issues.

The most common cause of this is the use of a reverse-proxy HTTP(S) server (often Apache or IIS) in front of the application server running JIRA. While this configuration is supported, some additional setup might be necessary in order to ensure that JIRA detects the correct scheme.

The following articles describe the issue and the steps you should take to ensure that your web server and app server are configured correctly:

Gadgets do not display correctly after upgrade to JIRA 4.0
Integrating JIRA with Apache
Integrating JIRA with Apache using SSL

If you believe this diagnosis is in error, or you have any other questions, please contact Atlassian Support.

Detailed Error

com.atlassian.gadgets.dashboard.internal.diagnostics.UrlSchemeMismatchException: Detected URL scheme, 'http', does not match expected scheme 'https'

经过多次尝试之后,发现一共需要修改两处。

第一处是修改系统界面中的BaseURL,把http换为https,如图:

BaseURL

第二处是修改Jira自带的tomcat配置文件(默认位置:/usr/local/atlassian/jira/conf/server.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    <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"

<!-- Lines added to solve the URL scheme mismatch -->
scheme="https"
proxyName="example.org"
proxyPort="443"
/>

把proxyName换成你的jira访问域名就可以了