# Could not make HTTP request to instance: connection closed before message completed

**URL:** <https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650>\
**Category:** General\
**Tags:** login-only\
**Created:** [August 7, 2023, 12:36pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650 "2023-08-07T12:36:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanmaysharma2021](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tanmaysharma2021](https://community.fly.io/u/tanmaysharma2021)\
**Post date:** [August 7, 2023, 12:36pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650/1 "2023-08-07T12:36:20Z")

</div>

I have deployed an elasticsearch container over Fly using a Dockerfile. The container operates over https protocol. But whenever i send the request to the deployed address, it shows this message:

 ![image](https://global.discourse-cdn.com/fly1/original/3X/4/e/4e1dc1f144581f9cdb9fcb9f0ffad97e76207809.png)

When i disabled http security in my configuration files, then it was able to accept the requests. So, as i understand what is happening is that i send https request to Fly on the deployed url, it receives them and sends a request to elasticsearch VM over http but the thing is elasticsearch receives request over https that’s why it is not working… is it a correct assumption? If it is how can i fix fly proxy to send https requests to elastic search??

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [August 7, 2023, 1:14pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650/2 "2023-08-07T13:14:37Z")

</div>

This is controlled by your fly.toml. If this currently contains a [http\_service](https://fly.io/docs/reference/configuration/) section you may need to replace it with [services](https://fly.io/docs/reference/configuration/#the-code-services-code-sections) section. Make sure that you do **not** specify the tls [handler](https://fly.io/docs/reference/services/#connection-handlers).

You may also need a [dedicated IPv4 address](https://fly.io/docs/reference/services/#dedicated-ipv4).

---

<div class="post-metadata">

**Author:** ![tanmaysharma2021](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tanmaysharma2021](https://community.fly.io/u/tanmaysharma2021)\
**Post date:** [August 7, 2023, 1:25pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650/3 "2023-08-07T13:25:52Z")

</div>

Hi thanks for your reply, this is my fly.toml file right now:

```auto
app = "elastic-search-container"
primary_region = "fra"

[build]

[http_service]
  internal_port = 9200
  force_https = true
  auto_stop_machines = false
  auto_start_machines = false
  min_machines_running = 0
  processes = ["app"]

```

will it work if i just changed it to this??:

```auto
app = "elastic-search-container"
primary_region = "fra"

[build]

[[services]
  internal_port = 9200
  force_https = true
  auto_stop_machines = false
  auto_start_machines = false
  min_machines_running = 0
  processes = ["app"]

```

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [August 7, 2023, 1:32pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650/4 "2023-08-07T13:32:52Z")

</div>

I haven’t tried it with elastic search, but your configuration will look more like the following:

```auto
[[services]]
  protocol = "tcp"
  internal_port = 9200
  processes = ["app"]

  [[services.ports]]
    port = 9200
    handlers = ["http"]
    force_https = true

```

---

<div class="post-metadata">

**Author:** ![tanmaysharma2021](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tanmaysharma2021](https://community.fly.io/u/tanmaysharma2021)\
**Post date:** [August 7, 2023, 1:46pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650/5 "2023-08-07T13:46:31Z")

</div>

Hi so i uploaded with this toml file and now i am getting this error:

 ![image](https://global.discourse-cdn.com/fly1/original/3X/1/5/1588de651bdb84b9022f6d1737099377add59ead.png)  
and from postman:  
 ![image](https://global.discourse-cdn.com/fly1/original/3X/a/e/ae6383030d351e1b0c95afd6a507e0887561f19c.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [August 14, 2023, 1:46pm UTC](https://community.fly.io/t/could-not-make-http-request-to-instance-connection-closed-before-message-completed/14650/6 "2023-08-14T13:46:59Z")

</div>

Closed on August 14, 2023, 1:46pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
