# \[solved\] Error with HTTPS

**URL:** <https://drone.discourse.group/t/solved-error-with-https/10917>\
**Category:** Drone Support\
**Created:** [November 17, 2020, 8:55am UTC](https://drone.discourse.group/t/solved-error-with-https/10917 "2020-11-17T08:55:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alvaro-solidrun](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/alvaro-solidrun/32/2878_2.png) [@Alvaro-solidrun](https://drone.discourse.group/u/Alvaro-solidrun)\
**Post date:** [November 17, 2020, 8:55am UTC](https://drone.discourse.group/t/solved-error-with-https/10917/1 "2020-11-17T08:55:19Z")

</div>

Hi,  
I am running a DRONE server in a server that is used as a web application server as well (using Apache).

Drone server command:

> docker run   
> –volume=/var/lib/drone:/data   
> –env=DRONE\_GITHUB\_CLIENT\_ID=CLIENT\_ID   
> –env=DRONE\_GITHUB\_CLIENT\_SECRET=CLIENT\_SECRET   
> –env=DRONE\_RPC\_SECRET=RPC\_SECRET   
> –env=DRONE\_SERVER\_HOST=SERVER\_IP   
> –env=DRONE\_SERVER\_PROTO=https   
> –env=DRONE\_YAML\_ENDPOINT=SOME\_URL   
> –publish=8080:80   
> –publish=8443:443   
> –restart=always   
> –detach=true   
> –name=drone   
> drone/drone:1

docker ps:

> id drone/drone:1 “/bin/drone-server” 29 minutes ago Up 29 minutes 0.0.0.0:8080-\>80/tcp, 0.0.0.0:8443-\>443/tcp drone

Now, the whole setup is working with http, means I can reach http://SERVER\_IP:8080/ and see the repositories.

But when I try to reach https://SERVER\_IP:8443/  
I get “This site can’t be reached”, “ERR\_CONNECTION\_CLOSED”.

Port 8443 is open in firewall, I’ve checked it running from my PC:

> nc -zvw3 IP\_ADDRESS 8443  
> Connection to IP\_ADDRESS 8443 port [tcp/\*] succeeded!

Anyone knows how to fix it?  
Thanks

---

<div class="post-metadata">

**Author:** ![csgitharness](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/csgitharness/32/904_2.png) [@csgitharness](https://drone.discourse.group/u/csgitharness)\
**Post date:** [November 17, 2020, 11:39am UTC](https://drone.discourse.group/t/solved-error-with-https/10917/2 "2020-11-17T11:39:34Z")

</div>

Hi,  
Have you tried using lets encrypt, with public certs so that it becomes htts by default?

> **[Certificates | Drone](https://docs.drone.io/server/https/)**

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 17, 2020, 2:04pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/3 "2020-11-17T14:04:45Z")

</div>

> [@\[SOLVED\] agent cannot connect to server](https://drone.discourse.group/t/solved-agent-cannot-connect-to-server/8363/2):
>
> Have you tried using lets encrypt, with public certs so that it becomes htts by default?

note that lets encrypt can only be used with port 80 and 443 and cannot be used with other ports. Since this individual already has an Apache web server running on the host using these ports, they would not be able to use lets encrypt.

---

<div class="post-metadata">

**Author:** ![Alvaro-solidrun](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/alvaro-solidrun/32/2878_2.png) [@Alvaro-solidrun](https://drone.discourse.group/u/Alvaro-solidrun)\
**Post date:** [November 17, 2020, 3:33pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/4 "2020-11-17T15:33:56Z")

</div>

Do you know how can I fix this issue?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 17, 2020, 3:43pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/5 "2020-11-17T15:43:48Z")

</div>

looking at your Drone server configuration, you are attempting to access Drone using the https address but you have not configured or mounted your ssl certificate. If no certificate is mounted, Drone cannot serve https requests. See [https://docs.drone.io/server/https/](https://docs.drone.io/server/https/)

---

<div class="post-metadata">

**Author:** ![Alvaro-solidrun](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/alvaro-solidrun/32/2878_2.png) [@Alvaro-solidrun](https://drone.discourse.group/u/Alvaro-solidrun)\
**Post date:** [November 18, 2020, 8:37am UTC](https://drone.discourse.group/t/solved-error-with-https/10917/6 "2020-11-18T08:37:17Z")

</div>

Hi,  
Following [Certificates | Drone](https://docs.drone.io/server/https/)  
I’ve added

> –env=DRONE\_TLS\_AUTOCERT=true

to the server configuration,  
Now I get " This site can’t provide a secure connection"  
“ERR\_SSL\_PROTOCOL\_ERROR”

I’ve also tried with DRONE\_TLS\_CERT and DRONE\_TLS\_KEY, but I don’t have .crt and .key files in Apache ssl folder, just “certificates” and “combined” files.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 18, 2020, 2:13pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/7 "2020-11-18T14:13:57Z")

</div>

@Alvaro-solidrun did you see my previous commands [here](http://discuss.harness.io/t/error-with-https/8363/5) and [here](http://discuss.harness.io/t/error-with-https/8363/3). You need to mount your ssl certs as a volume into your container, as shown in the [Certificates](https://docs.drone.io/server/https/#certificates) section of the docs. You cannot use Lets Encrypt (autocert) with Drone because this requires ports 443 and 80 and will not work with the ports you have configured (8443 and 8080).

---

<div class="post-metadata">

**Author:** ![Alvaro-solidrun](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/alvaro-solidrun/32/2878_2.png) [@Alvaro-solidrun](https://drone.discourse.group/u/Alvaro-solidrun)\
**Post date:** [November 18, 2020, 3:21pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/8 "2020-11-18T15:21:08Z")

</div>

Thanks for the replay,  
I actually did intend to use this approach,  
But I got  
“Your connection is not private” “ERR\_CERT\_COMMON\_NAME\_INVALID” errors.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [November 18, 2020, 3:30pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/9 "2020-11-18T15:30:17Z")

</div>

Drone is written in Go and the Go standard library has a function called [`ListenAndServeTLS`](https://golang.org/pkg/net/http/#ListenAndServeTLS). This function is used to server https traffic, and accepts your certificate file path and your key file path as show below.

```nohighlight
func ListenAndServeTLS(addr, certFile, keyFile string, handler Handler) error

```

It is unlikely to be a bug with the Go standard library and how it handles https, which would therefore lead me to suggest that perhaps there is a problem with your certificate files. I did some quick googling which suggests this may be the case [1]. Unfortunately this is not an area of expertise of mine so I cannot offer much help.

I would also point out that, if your certificates are self-signed, this may also cause problems for clients that are trying to access the Drone server address. You may need to configure these clients to ignore ssl verification before they will proceed.

[1] [https://stackoverflow.com/questions/44711260/chrome-59-neterr-cert-common-name-invalid](https://stackoverflow.com/questions/44711260/chrome-59-neterr-cert-common-name-invalid)

---

<div class="post-metadata">

**Author:** ![Alvaro-solidrun](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/alvaro-solidrun/32/2878_2.png) [@Alvaro-solidrun](https://drone.discourse.group/u/Alvaro-solidrun)\
**Post date:** [November 18, 2020, 3:35pm UTC](https://drone.discourse.group/t/solved-error-with-https/10917/10 "2020-11-18T15:35:25Z")

</div>

Ok, I’ll check it out.  
Thanks
