Read error (Connection reset by peer) in headers #1624

Closed
opened 2025-10-09 17:23:01 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @StarScream159 on GitHub.

Subject of the issue

Read error (Connection reset by peer) in headers.

Your environment

  • Bitwarden_rs version: 1.16.3
  • Install method: docker
  • Clients used: web/curl/wget
  • Reverse proxy and version: NA
  • Version of mysql/postgresql: NA
  • Other relevant information:
[root@centbox bitwarden]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@centbox bitwarden]# docker --version
Docker version 18.09.7, build 2d0083d
[root@centbox bitwarden]# docker-compose --version
docker-compose version 1.24.0, build 0aa59064
[root@centbox bitwarden]#

Steps to reproduce

Start/install the application with docker:
docker run -d --name bitwarden -e WEBSOCKET_ENABLED=true -e LOG_FILE=/data/bitwarden.log -v /opt/bitwarden/:/data/ -p 32080:80 -p 3012:3012 bitwardenrs/server:latest

Expected behaviour

To be able to load the interface via web browser, or get a html response via wget/curl.

Actual behaviour

docker starts okay:

[root@centbox bitwarden]# docker logs bitwarden
/--------------------------------------------------------------------\
|                       Starting Bitwarden_RS                        |
|                           Version 1.16.3                           |
|--------------------------------------------------------------------|
| This is an *unofficial* Bitwarden implementation, DO NOT use the   |
| official channels to report bugs/features, regardless of client.   |
| Send usage/configuration questions or feature requests to:         |
|   https://bitwardenrs.discourse.group/                             |
| Report suspected bugs/issues in the software itself at:            |
|   https://github.com/dani-garcia/bitwarden_rs/issues/new           |
\--------------------------------------------------------------------/

[2020-09-08 19:05:03.446][ws][INFO] Listening for new connections on 0.0.0.0:3012.
[2020-09-08 19:05:03.446][start][INFO] Rocket has launched from http://0.0.0.0:80
[root@centbox bitwarden]#

However trying to connect to the service on the server via IP in browser (http://192.168.2.25:32080/) fails with an "This site can’t be reached. 192.168.2.25 took too long to respond.".

Also accessing via command line directly on the server via wget or curl gets me the connection reset:

[root@centbox bitwarden]# wget http://localhost:32080
--2020-09-08 15:10:48--  http://localhost:32080/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:32080... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying. ^C
[root@centbox bitwarden]#
[root@centbox bitwarden]# curl http://localhost:32080
curl: (56) Recv failure: Connection reset by peer
[root@centbox bitwarden]#

Docker appears okay:

[root@centbox bitwarden]# docker ps -a
CONTAINER ID        IMAGE                                 COMMAND             CREATED             STATUS                   PORTS                                           NAMES
a172efe73114        bitwardenrs/server:latest             "/start.sh"         6 minutes ago       Up 6 minutes (healthy)   0.0.0.0:3012->3012/tcp, 0.0.0.0:32080->80/tcp   bitwarden
[root@centbox bitwarden]#

No other information appears in the docker log (via docker logs bitwarden) or via the /data/bitwarden.log file. It's as if the connection doesn't each the application in docker.

The port chosen (32080) isn't used for anything else.

Anyone got any ideas? Thanks.

EDIT:
If I run curl within the container, you get the expected response:

[root@centbox bitwarden]# docker exec -it bitwarden curl http://localhost
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=1010">
    <meta name="theme-color" content="#175DDC">

    <title page-title>Bitwarden Web Vault</title>

    <link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png">
    <link rel="mask-icon" href="images/icons/safari-pinned-tab.svg" color="#175DDC">
    <link rel="manifest" href="manifest.json">
<link href="app/main.ec1191668ddd60d16e05.css" rel="stylesheet"></head>

<body class="layout_frontend">
    <app-root>
        <div class="mt-5 d-flex justify-content-center">
            <div>
                <img src="images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
                <p class="text-center">
                    <i class="fa fa-spinner fa-spin fa-2x text-muted" title="Loading" aria-hidden="true"></i>
                </p>
            </div>
        </div>
    </app-root>
<script type="text/javascript" src="app/polyfills.ec1191668ddd60d16e05.js"></script><script type="text/javascript" src="app/vendor.ec1191668ddd60d16e05.js"></script><script type="text/javascript" src="app/main.ec1191668ddd60d16e05.js"></script></body>

</html>
[root@centbox bitwarden]# 
Originally created by @StarScream159 on GitHub. ### Subject of the issue Read error (Connection reset by peer) in headers. ### Your environment * Bitwarden_rs version: 1.16.3 * Install method: docker * Clients used: web/curl/wget * Reverse proxy and version: NA * Version of mysql/postgresql: NA * Other relevant information: ``` [root@centbox bitwarden]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@centbox bitwarden]# docker --version Docker version 18.09.7, build 2d0083d [root@centbox bitwarden]# docker-compose --version docker-compose version 1.24.0, build 0aa59064 [root@centbox bitwarden]# ```` ### Steps to reproduce Start/install the application with docker: `docker run -d --name bitwarden -e WEBSOCKET_ENABLED=true -e LOG_FILE=/data/bitwarden.log -v /opt/bitwarden/:/data/ -p 32080:80 -p 3012:3012 bitwardenrs/server:latest` ### Expected behaviour To be able to load the interface via web browser, or get a html response via wget/curl. ### Actual behaviour docker starts okay: ``` [root@centbox bitwarden]# docker logs bitwarden /--------------------------------------------------------------------\ | Starting Bitwarden_RS | | Version 1.16.3 | |--------------------------------------------------------------------| | This is an *unofficial* Bitwarden implementation, DO NOT use the | | official channels to report bugs/features, regardless of client. | | Send usage/configuration questions or feature requests to: | | https://bitwardenrs.discourse.group/ | | Report suspected bugs/issues in the software itself at: | | https://github.com/dani-garcia/bitwarden_rs/issues/new | \--------------------------------------------------------------------/ [2020-09-08 19:05:03.446][ws][INFO] Listening for new connections on 0.0.0.0:3012. [2020-09-08 19:05:03.446][start][INFO] Rocket has launched from http://0.0.0.0:80 [root@centbox bitwarden]# ``` However trying to connect to the service on the server via IP in browser (http://192.168.2.25:32080/) fails with an "This site can’t be reached. 192.168.2.25 took too long to respond.". Also accessing via command line directly on the server via wget or curl gets me the connection reset: ``` [root@centbox bitwarden]# wget http://localhost:32080 --2020-09-08 15:10:48-- http://localhost:32080/ Resolving localhost (localhost)... ::1, 127.0.0.1 Connecting to localhost (localhost)|::1|:32080... connected. HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers. Retrying. ^C [root@centbox bitwarden]# [root@centbox bitwarden]# curl http://localhost:32080 curl: (56) Recv failure: Connection reset by peer [root@centbox bitwarden]# ``` Docker appears okay: ``` [root@centbox bitwarden]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a172efe73114 bitwardenrs/server:latest "/start.sh" 6 minutes ago Up 6 minutes (healthy) 0.0.0.0:3012->3012/tcp, 0.0.0.0:32080->80/tcp bitwarden [root@centbox bitwarden]# ``` No other information appears in the docker log (via docker logs bitwarden) or via the /data/bitwarden.log file. It's as if the connection doesn't each the application in docker. The port chosen (32080) isn't used for anything else. Anyone got any ideas? Thanks. EDIT: If I run curl within the container, you get the expected response: ``` [root@centbox bitwarden]# docker exec -it bitwarden curl http://localhost <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=1010"> <meta name="theme-color" content="#175DDC"> <title page-title>Bitwarden Web Vault</title> <link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png"> <link rel="mask-icon" href="images/icons/safari-pinned-tab.svg" color="#175DDC"> <link rel="manifest" href="manifest.json"> <link href="app/main.ec1191668ddd60d16e05.css" rel="stylesheet"></head> <body class="layout_frontend"> <app-root> <div class="mt-5 d-flex justify-content-center"> <div> <img src="images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden"> <p class="text-center"> <i class="fa fa-spinner fa-spin fa-2x text-muted" title="Loading" aria-hidden="true"></i> </p> </div> </div> </app-root> <script type="text/javascript" src="app/polyfills.ec1191668ddd60d16e05.js"></script><script type="text/javascript" src="app/vendor.ec1191668ddd60d16e05.js"></script><script type="text/javascript" src="app/main.ec1191668ddd60d16e05.js"></script></body> </html> [root@centbox bitwarden]# ```
Author
Owner

@StarScream159 commented on GitHub:

It appears my docker setup isn't correct, as adding the --network host flag to my docker run command fixed the issue. So the following command works for me:

docker run -d --network host --name bitwarden -e WEBSOCKET_ENABLED=true -e LOG_FILE=/data/bitwarden.log -e ROCKET_PORT=32080 -v /opt/bitwarden/:/data/ bitwardenrs/server:latest

Of course I had to also add the -e ROCKET_PORT=32080 flag, or bitwarden attempted to start on port 80 which is in use on my system. And this also means that the websocket is running on the default 3012 on my host system occupying that port too.

I'd like to know what I've done to my docker config though.

@StarScream159 commented on GitHub: It appears my docker setup isn't correct, as adding the `--network host` flag to my docker run command fixed the issue. So the following command works for me: ``` docker run -d --network host --name bitwarden -e WEBSOCKET_ENABLED=true -e LOG_FILE=/data/bitwarden.log -e ROCKET_PORT=32080 -v /opt/bitwarden/:/data/ bitwardenrs/server:latest ``` Of course I had to also add the `-e ROCKET_PORT=32080` flag, or bitwarden attempted to start on port 80 which is in use on my system. And this also means that the websocket is running on the default 3012 on my host system occupying that port too. I'd like to know what I've done to my docker config though.
Author
Owner

@BlackDex commented on GitHub:

Closing this ticket because of inactivity.
Feel free to continue this discussion on the forum: https://bitwardenrs.discourse.group/

@BlackDex commented on GitHub: Closing this ticket because of inactivity. Feel free to continue this discussion on the forum: https://bitwardenrs.discourse.group/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#1624