# Valid Certificate Path Problem

**URL:** <https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888>\
**Category:** Ignition Early Access\
**Created:** [July 25, 2019, 5:59pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888 "2019-07-25T17:59:43Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![d3h637](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@d3h637](https://forum.inductiveautomation.com/u/d3h637)\
**Post date:** [December 16, 2019, 3:28pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/21 "2019-12-16T15:28:25Z")

</div>

Thank you so much for the quick response. Unfortunately, that didn’t get rid of the error. Below is my script, and the error I’m receiving. Does this look right? The code works with 7.9.4, but not 8.0.3.

headers = {“username”:“username”, “password”:“password”, “bypassCertValidation”:“True”}  
response = system.net.httpPost(“[https://url](https://url)”, headers)  
PyResponse = system.util.jsonDecode(response)

… Process PyResponse

Traceback (most recent call last):  
File “event:actionPerformed”, line 3, in   
IOError: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 16, 2019, 3:43pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/22 "2019-12-16T15:43:23Z")

</div>

Nope - you need to pass `bypassCertValidation=True` as a keyword argument to the `system.net.httpPost` function, like so:

```auto
headers = {“username”:“username”, “password”:“password”}
response = system.net.httpPost(“https://url”, headers, bypassCertValidation=True)
PyResponse = system.util.jsonDecode(response)

```

Also, tooting my own horn, but if you upgrade to 8.0.6 you can use the new [`system.net.httpClient`](https://docs.inductiveautomation.com/display/DOC80/system.net.httpClient), which is a bit more powerful and generally gives you better error messages as well. The equivalent code snippet would be:

```auto
headers = {“username”:“username”, “password”:“password”}
PyResponse = system.net.httpClient(bypass_cert_validation=True).post(“https://url”, headers=headers).json

```

---

<div class="post-metadata">

**Author:** ![c-w-t](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@c-w-t](https://forum.inductiveautomation.com/u/c-w-t)\
**Post date:** [December 16, 2019, 6:40pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/23 "2019-12-16T18:40:27Z")

</div>

Ohhhhh I didn’t know about this one!! Missed it in the release notes I guess.

---

<div class="post-metadata">

**Author:** ![d3h637](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@d3h637](https://forum.inductiveautomation.com/u/d3h637)\
**Post date:** [March 4, 2021, 8:20pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/24 "2021-03-04T20:20:59Z")

</div>

After talking with the vendor, I waited on a new version of the API before I kept working on this. I used your httpClient in this new code, but get an error 411 when I send the post. This appears to be an issue with Content-Length not being sent. However, if I try to include Content-Length in the headers, I get an error that Content-Length is protected. Any ideas. Below is the code I have.

Client = system.net.httpClient(bypass\_cert\_validation=True, username=“username”, password=“password”)  
Response = Client.post(“[https://URL](https://URL)”)  
print Response.statusCode

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 4, 2021, 8:45pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/25 "2021-03-04T20:45:36Z")

</div>

The underlying Java HTTPClient only sends the Content-Length header if it’s 1: capable of determining it and 2: if it’s not 0. Unfortunately, that means you have to send _some_ body to get the client to send a Content-Length header, which may end up causing a different error with your server…

```auto
for k, v in system.net.httpClient().post("https://httpbin.org/post", data="a").json.items():
	print k, v

```

```auto
>>>
headers {'User-Agent': u'Ignition', 'Host': u'httpbin.org', 'X-Amzn-Trace-Id': u'Root=1-60414683-5b27b6ba2e1168104773e0c9', 'Content-Length': u'1', 'Content-Type': u'text/plain; charset=utf-8'}
data 1
origin 104.220.10.151
url https://httpbin.org/post
args {}
form {}
files {}
json 1

```

---

<div class="post-metadata">

**Author:** ![d3h637](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@d3h637](https://forum.inductiveautomation.com/u/d3h637)\
**Post date:** [March 4, 2021, 9:07pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/26 "2021-03-04T21:07:02Z")

</div>

Thanks for the quick response. That worked. I sent the username and password in the data instead of the header, and that resolved the problem.

---

<div class="post-metadata">

**Author:** ![Shyam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shyam/32/42528_2.png) [@Shyam](https://forum.inductiveautomation.com/u/Shyam)\
**Post date:** [October 10, 2024, 8:32am UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/27 "2024-10-10T08:32:29Z")

</div>

do we have any other fix for this?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 10, 2024, 2:00pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/28 "2024-10-10T14:00:25Z")

</div>

This post is pretty old. Go ahead and start a new topic where you explain the issue you're having, including your Ignition version and any other relevant details.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 10, 2024, 2:00pm UTC](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888/29 "2024-10-10T14:00:30Z")

</div>

Closed on October 10, 2024, 2:00pm UTC



[Previous page](https://forum.inductiveautomation.com/t/valid-certificate-path-problem/26888.md?page=1)
