# Error parsing HTTP request header with dockerized application

**URL:** <https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159>\
**Category:** Issues with deployment\
**Tags:** v2\
**Created:** [June 11, 2020, 3:52pm UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159 "2020-06-11T15:52:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 11, 2020, 3:53pm UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/1 "2020-06-11T15:53:00Z")

</div>

Hi,  
I have deployed my OpenVidu application and OpenVidu platform to AWS as told in these links:  
[https://docs.openvidu.io/en/2.14.0/deployment/deploying-aws/](https://docs.openvidu.io/en/2.14.0/deployment/deploying-aws/)  
[https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/](https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/)  
The OpenVidu Call application works fine along with the test in /dashboard/ .

But when I deploy my dockerized OpenVidu application, I get this error when joining / creating a meeting:

` openvidu-server_1 | [INFO] 2020-06-11 15:36:27,932 [0.0-5443-exec-1] org.apache.coyote.http11.Http11Processor - Error parsing HTTP request header openvidu-server_1 | Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level. openvidu-server_1 | java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens openvidu-server_1 | at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:415) openvidu-server_1 | at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260) openvidu-server_1 | at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) openvidu-server_1 | at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) openvidu-server_1 | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) openvidu-server_1 | at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) openvidu-server_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) openvidu-server_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) openvidu-server_1 | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) openvidu-server_1 | at java.lang.Thread.run(Thread.java:748)`

What am I doing wring here?  
Thanks

---

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 11, 2020, 4:34pm UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/2 "2020-06-11T16:34:09Z")

</div>

I have even tried installing natively:  
[https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/#installed-natively](https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/#installed-natively)  
I am getting an error, which might be the same one before but here are the logs:

```auto
<ref *2> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: false,
closed: false
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/api/sessions',
method: 'POST',
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
Authorization: 'Basic T1BFTlZJRFVBUFA6ZTRlNW5mM25jNmJjNGJjNWI0',
'User-Agent': 'axios/0.19.2',
'Content-Length': 160
},
agent: undefined,
agents: { http: undefined, https: undefined },
auth: undefined,
hostname: 'localhost',
port: '5443',
nativeProtocols: { 'http:': [Object], 'https:': [Object] },
pathname: '/api/sessions'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 160,
_requestBodyBuffers: [
{
data: <Buffer 7b 22 6d 65 64 69 61 4d 6f 64 65 22 3a 22 52 4f 55 54 45 44 22 2c 22 72 65 63 6f 72 64 69 6e 67 4d 6f 64 65 22 3a 22 4d 41 4e 55 41 4c 22 2c 22 64 65 ... 110 more bytes>,
encoding: undefined
}
],
_onNativeResponse: [Function (anonymous)],
_currentRequest: <ref *1> ClientRequest {
_events: [Object: null prototype] {
response: [Function],
socket: [Function (anonymous)],
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
error: [Function (anonymous)],
timeout: [Function (anonymous)]
},
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: false,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: null,
alpnProtocol: null,
authorized: false,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: true,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: false,
parser: null,
_httpMessage: [Circular *1],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: false,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 239,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 417,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 417,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /api/sessions HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json\r\n' +
'Authorization: Basic T1BFTlZJRFVBUFA6ZTRlNW5mM25jNmJjNGJjNWI0\r\n' +
'User-Agent: axios/0.19.2\r\n' +
'Content-Length: 160\r\n' +
'Host: localhost:5443\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/sessions',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular *2],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
authorization: [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array]
}
},
_currentUrl: 'https://localhost:5443/api/sessions',
[Symbol(kCapture)]: false
}
Error: [object Object]
at /opt/openvidu/project/node_modules/openvidu-node-client/lib/Session.js:421:28
at processTicksAndRejections (internal/process/task_queues.js:97:5)

```

But still I am not able to debug this issue ☹  
EDIT:  
It seems like I get the same error locally, but is solved by using a HTTPS server, but over [here](https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/), it says to have a HTTP server for deployment. By the way, The error comes when executing this line:  
`OV.createSession()`

Thanks

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [June 12, 2020, 10:46am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/3 "2020-06-12T10:46:28Z")

</div>

> but over [here](https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/), it says to have a HTTP server for deployment.

It works with plain http because there’s an nginx docker container that redirects https petitions from  
port 443 to the application running at port 5442.

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [June 12, 2020, 10:46am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/4 "2020-06-12T10:46:37Z")

</div>

It seems like your application is not doing well requests to openvidu server. I guess by the log you’ve written that you’re making HTTPS requests to your OpenVidu server from your server app, but you should use HTTP. In fact, the openvidu url should be:  
`http://localhost:5443`  
Your app should request this url. Be sure that your app, in production, make requests to this url.

---

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 12, 2020, 10:50am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/5 "2020-06-12T10:50:52Z")

</div>

Hi,  
Thanks for the reply,  
I had tried with `http://localhost:5443` before and it did not work, so I tried with https  
Any way here is the log for using http:

```auto
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: false,
closed: false
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/api/sessions',
method: 'POST',
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
Authorization: 'Basic T1BFTlZJRFVBUFA6ZTRlNW5mM25jNmJjNGJjNWI0',
'User-Agent': 'axios/0.19.2',
'Content-Length': 160
},
agent: undefined,
agents: { http: undefined, https: undefined },
auth: undefined,
hostname: 'localhost',
port: '5443',
nativeProtocols: { 'http:': [Object], 'https:': [Object] },
pathname: '/api/sessions'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 160,
_requestBodyBuffers: [
{
data: <Buffer 7b 22 6d 65 64 69 61 4d 6f 64 65 22 3a 22 52 4f 55 54 45 44 22 2c 22 72 65 63 6f 72 64 69 6e 67 4d 6f 64 65 22 3a 22 4d 41 4e 55 41 4c 22 2c 22 64 65 ... 110 more bytes>,
encoding: undefined
}
],
_onNativeResponse: [Function (anonymous)],
_currentRequest: <ref *1> ClientRequest {
_events: [Object: null prototype] {
response: [Function],
socket: [Function (anonymous)],
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
error: [Function (anonymous)],
timeout: [Function (anonymous)]
},
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: false,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: null,
alpnProtocol: null,
authorized: false,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: true,
_parent: null,
_host: 'localhost',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *1],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: false,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 165,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 417,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 417,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /api/sessions HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json\r\n' +
'Authorization: Basic T1BFTlZJRFVBUFA6ZTRlNW5mM25jNmJjNGJjNWI0\r\n' +
'User-Agent: axios/0.19.2\r\n' +
'Content-Length: 160\r\n' +
'Host: localhost:5443\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/sessions',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular *2],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
authorization: [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array]
}
},
_currentUrl: 'https://localhost:5443/api/sessions',
[Symbol(kCapture)]: false
}
Error: [object Object]
at /opt/openvidu/project/node_modules/openvidu-node-client/lib/Session.js:421:28
at processTicksAndRejections (internal/process/task_queues.js:97:5)

```

Thanks

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [June 12, 2020, 11:10am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/6 "2020-06-12T11:10:01Z")

</div>

You’re right. I’ve check our openvidu-node-client, and version 2.14.0 is forcing https. We’ve fixed this for version 2.15.0 that is coming out soon 🙂

A workaround you can do, is to use the public url of your openvidu-server. So for example if your application is deployed with a domain name like: `example.com` you should put this in your `docker-compose.override.yml`:

```auto
environment:
            - SERVER_PORT=5442
            - OPENVIDU_URL=https://example.com
            - OPENVIDU_SECRET=${OPENVIDU_SECRET}

```

On version 2.15.0 you should be able to use `http://localhost:5443`

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [June 12, 2020, 11:53am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/7 "2020-06-12T11:53:34Z")

</div>

Same bug: [Node-client: GetSession Fails in production for custom dockerized app (Bug?)](https://openvidu.discourse.group/t/node-client-getsession-fails-in-production-for-custom-dockerized-app-bug/1155/2)

---

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 12, 2020, 12:01pm UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/8 "2020-06-12T12:01:22Z")

</div>

Hi,  
Sorry for not seeing that topic before.  
I tried the workaround you provided. It stoped the error 😀, but the web page gives a timeout. There are no errors in the log though.

---

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 12, 2020, 12:46pm UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/9 "2020-06-12T12:46:59Z")

</div>

By the way, Is there a way to access the logs given from my node application if I am using docker?  
Thanks

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [June 12, 2020, 9:47pm UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/10 "2020-06-12T21:47:31Z")

</div>

$ docker logs

---

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 13, 2020, 4:16am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/11 "2020-06-13T04:16:27Z")

</div>

Thanks,  
I have (possibly) debugged the issue.  
One more question, I have a mongodb docker container alongside my app like:

```auto
version: '3.1'

services:
    mongodb:
        image: mongo

    app:
        image: (docker image)
        restart: on-failure
        network_mode: host
        environment:
            - SERVER_PORT=5442
            - OPENVIDU_URL=https://localhost:5443
            - OPENVIDU_SECRET=${OPENVIDU_SECRET}

```

I am not able to access the MongoDB container to store information. I have tried connecting to the following urls with my node application (mongoose):

- `mongodb://mongodb:27017/DatabaseName`
- `mongodb://openvidu_mongodb_1:27017/DatabaseName`

But both do not work.  
Is it by any chance that 27017 is a blocked port?

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [June 13, 2020, 8:03am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/12 "2020-06-13T08:03:38Z")

</div>

You should configure mongo with

network\_mode: host

And use “localhost” as host to connect to it from your app container.

Regards

---

<div class="post-metadata">

**Author:** ![Arush\_Gupta](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/arush_gupta/32/611_2.png) [@Arush\_Gupta](https://openvidu.discourse.group/u/Arush_Gupta)\
**Post date:** [June 13, 2020, 8:15am UTC](https://openvidu.discourse.group/t/error-parsing-http-request-header-with-dockerized-application/1159/13 "2020-06-13T08:15:39Z")

</div>

Hi,  
I just solved it by running a mongo image in detach mode and using localhost to connect 😀  
Thanks Anyway
