Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

nginx proxy ssl + JIRA Oauth summary:Field 'summary' cannot be set.

秦良 March 18, 2021

Hi
I want to use the Jira Reset API to create issue
But when you have a problem, ask for help

get crowd token --> jira restet api --> nginx proxy(ssl 443) -->tomcat(jira port18080)
create issue is not ok ?
{"errorMessages":[],"errors":{"summary":"Field 'summary' cannot be set. It is not on the appropriate screen, or unknown. (truncated...)

because
get crowd token --> jira restet api --> tomcat(jira port18080)
create issue is ok

So, I would like to know if there is a configuration problem with NGINX or a code problem, how to fix it

_______________________
#nginx.conf for jira
server {
listen 443 ssl;
server_name jira.xxxxx.com;
ssl_certificate /etc/ssl/certs/jira.xxxxx.com.pem;
ssl_certificate_key /etc/ssl/private/jira.xxxxx.com.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
proxy_redirect off;

location / {
client_max_body_size 10M;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:18080;
proxy_buffer_size 64k;
proxy_buffers 4 128k;
}
access_log /var/log/nginx/jira443.log main;
}


server {
listen 443 ssl;
server_name crowd.xxxxx.com;
ssl_certificate /etc/ssl/certs/jira.xxxxx.com.pem;
ssl_certificate_key /etc/ssl/private/jira.xxxxx.com.key;
ssl_session_cache shared:MozSSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_session_timeout 10m;

location / {
client_max_body_size 10M;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8095/;
proxy_redirect off;
}
access_log /var/log/nginx/crowd443.log main;
}
_______________________

_______________________
#server.xml for jira
<Connector port="18080" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^&#x5c;&#x60;&quot;&lt;&gt;"
maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true" redirectPort="8443"
acceptCount="100" disableUploadTimeout="true" bindOnInit="false"
proxyName="jira.xxxxx.com"
sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2,TLSv1.3"
clientAuth="true"
proxyPort="443" scheme="https" secure="true"/>
_______________________

_______________________
#create issue code for jira
try {
$crowd = OfficeAdmin::app()->getParameter("app.crowd");
$token = self::getToken($reporter);
$cookieJar = CookieJar::fromArray(["crowd.token_key" => $token], self::getJiraDomain());
$client = new Client(['cookies' => $cookieJar]);
$proxy = OfficeAdmin::app()->getParameter('app.proxy');

$jsonArray = [
"event" => 'jira_create_issue_start',
"params" => [
"project_key" => $project,
"issuetype_name" => $issuetype,
"assignee_name" => $assignee,
"summary" => $summary,
"description" => $description,
"token" => $token,
"cookieJar" => $cookieJar,
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
"url" => $crowd['jira_url'] . "/rest/api/2/issue"
],
];
minfo(\GuzzleHttp\json_encode($jsonArray));

/**Whether to enable the proxy Settings**/
$optins = [
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
"fields" => [
"project" => [
'key' => $project,
],
"issuetype" => [
'name' => $issuetype,
],
"assignee" => [
"name" => $assignee,
],
"summary" => $summary,
"description" => $description,

],
],
'timeout' => 15,
];
if ($proxy !== 'proxy') {
$optins['proxy'] = $proxy;
}

$result = $client->post(
$crowd['jira_url'] . "/rest/api/2/issue",
$optins
);

$jsonArray["event"] = "jira_create_issue_end";
$jsonArray["result"] = $result;
minfo(\GuzzleHttp\json_encode($jsonArray));

$ret = \GuzzleHttp\json_decode($result->getBody()->getContents(), true);

if (isset($ret['id'])) {
minfo("Jira create issue ret:%s", json_encode($ret));
$ret['url'] = $crowd['jira_url'] . "/browse/" . $ret['key'];
return $ret;
}else{
throw new \ErrorException('Jira create issue fail');
}
_______________________

0 answers

Suggest an answer

Log in or Sign up to answer