Forums

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

Making POST request on HTTPS using Jira API in a Jira instance

Jamshaid
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2022

My Jira instance is running on an HTTPS port. I have written a script that creates sub-tasks of a task in a project using a Jira API POST request on the Jira instance. It was working fine on my HTTP version. When I shifted to the HTTPS version, it started giving errors.

 

Error 1:

It gave the certificate error that was not present in Java.

Resolution. I resolved the issue using the below commands in my Jira instance.

openssl x509 -in <(openssl s_client -connect 192.168.2.214:8083 -prexit 2>/dev/null) -out ~/server-name.crt

sudo keytool -importcert -file ~/server-name.crt -alias server-name -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit

 My Instance is running on AWS and has different internal and external IPs to access it.

The problem I am facing after resolving the above issue is :

javax.net.ssl.SSLHandshakeException: No subject alternative names matching IP address 192.168.2.214 found
at Script2.run(Script2.groovy:11)
Caused by: java.security.cert.CertificateException: No subject alternative names matching IP address 192.168.2.214 found
... 1 more

My internal IP is 192.168.2.214 and my external IP is different from it.

My external IP is mapped to a URL and the certificate is purchased against that URL.

How do I get rid of this error as I only can access my HTTPS port using the internal IP when making an API call and there is no HTTP port defined. If I define an HTTP port, I would need to reconstruct my whole instance which is not possible at the moment.

 

 

1 answer

1 accepted

0 votes
Answer accepted
Jamshaid
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2022

I found a workaround for it.
Use the HTTP port as there is always one for it with HTTP.

def connection1 = new URL("http://internal-IP:9095/rest/api/2/issue/").openConnection() as HttpURLConnection

 I earlier tried different combinations but was not successful but this one worked.

Suggest an answer

Log in or Sign up to answer