# Get into https webpage

**URL:** <https://forum.crystal-lang.org/t/get-into-https-webpage/623>\
**Category:** Help & Support\
**Created:** [March 31, 2019, 10:48am UTC](https://forum.crystal-lang.org/t/get-into-https-webpage/623 "2019-03-31T10:48:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![majonez](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@majonez](https://forum.crystal-lang.org/u/majonez)\
**Post date:** [March 31, 2019, 10:48am UTC](https://forum.crystal-lang.org/t/get-into-https-webpage/623/1 "2019-03-31T10:48:44Z")

</div>

i’ve tried to get into webpage content, but receive an error message:

> SSL\_connect: error:14090086:SSL routines:SSL3\_GET\_SERVER\_CERTIFICATE:certificate verify failed

there is no problem to get into that page by web browser or curl. i’ve also run that code successfully on other domains like [https://example.org](https://example.org) or https:// httpbin .org

here is the extract from my code:

[code](https://carc.in/#/r/6mij) (unfortunately it doesn’t work online, so you should run it locally)

i’m don’t know how to fix it, i’m not good at ssl stuff.  
could anyone help me?

---

<div class="post-metadata">

**Author:** ![vladfaust](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/vladfaust/32/48_2.png) [@vladfaust](https://forum.crystal-lang.org/u/vladfaust)\
**Post date:** [March 31, 2019, 11:02am UTC](https://forum.crystal-lang.org/t/get-into-https-webpage/623/2 "2019-03-31T11:02:27Z")

</div>

The [https://files.egplusww.com/](https://files.egplusww.com/) webpage does not open in my Chrome browser as well. Looks like it has a problem with certificate.

---

<div class="post-metadata">

**Author:** ![majonez](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@majonez](https://forum.crystal-lang.org/u/majonez)\
**Post date:** [March 31, 2019, 11:50am UTC](https://forum.crystal-lang.org/t/get-into-https-webpage/623/3 "2019-03-31T11:50:52Z")

</div>

if i set ssl context to  
`context = OpenSSL::SSL::Context::Client.insecure`

and add that to http/client  
`client = HTTP::Client.new(uri, tls: context)`

i rid off the error message, but page is still inaccessible.  
`@status_code=400, @status_message="Bad Request"`

and i don’t like using insecure method as a solution.

– edit  
i’ve changed to a webserver with the valid certificate, but the only change is another error message:

```
Error reading socket: Connection reset by peer

```

[code with changed server](https://carc.in/#/r/6mja)

---

<div class="post-metadata">

**Author:** ![majonez](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@majonez](https://forum.crystal-lang.org/u/majonez)\
**Post date:** [April 8, 2019, 8:47am UTC](https://forum.crystal-lang.org/t/get-into-https-webpage/623/4 "2019-04-08T08:47:09Z")

</div>

SOLVED!  
there was an issue on local machine with openssl and homebrew. solution was simple: **read the console messages** 🙂

below is a message from `brew install crystal`

> A CA file has been bootstrapped using certificates from the SystemRoots  
> keychain. To add additional certificates (e.g. the certificates added in  
> the System keychain), place .pem files in  
> ` /usr/local/etc/openssl/certs`
> 
> and run  
> ` /usr/local/opt/openssl/bin/c_rehash`
> 
> openssl is keg-only, which means it was not symlinked into /usr/local,  
> because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
> 
> If you need to have openssl first in your PATH run:  
> ` echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile`
> 
> For pkg-config to find openssl you may need to set:  
> ` export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"`
