# Error when working with grpc

**URL:** <https://discourse.haproxy.org/t/error-when-working-with-grpc/3634>\
**Category:** Help!\
**Created:** [March 18, 2019, 11:59am UTC](https://discourse.haproxy.org/t/error-when-working-with-grpc/3634 "2019-03-18T11:59:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrey090594](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@andrey090594](https://discourse.haproxy.org/u/andrey090594)\
**Post date:** [March 18, 2019, 11:59am UTC](https://discourse.haproxy.org/t/error-when-working-with-grpc/3634/1 "2019-03-18T11:59:05Z")

</div>

Hello, we have problems with haproxy 1.9.4 when working with grpc.

We use bidirectional streaming of data and receive this error every 30 seconds (it’s timeout server in our configuration).

```
io.grpc.StatusRuntimeException: UNAVAILABLE: HTTP status code 504
invalid content-type: text/html
headers: Metadata(:status=504,cache-control=no-cache,content-type=text/html)
DATA-----------------------------
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>
DATA-----------------------------

```

Our configuration:

```
defaults
	log	global
	mode	http
	option	httplog
	option socket-stats
	option logasap 
	option http-use-htx
    option forwardfor
	timeout connect 30000
    timeout client 30s
    timeout server 30s
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

frontend main-http-grpc
    description http:8080,grpc:9090 
	option http-use-htx
    option forwardfor
	bind *:8080 name main-http 
	bind *:9090 name main-grpc proto h2
	acl http dst_port eq 8080
	acl grpc dst_port eq 9090

	use_backend testhost if http { hdr_beg(host) -i testhost.local }
	use_backend testhost-grpc if grpc { hdr_beg(host) -i testhost.local }

backend testhost
        description http
        option forwardfor
        option httpchk OPTIONS /status
        server testhost1 10.10.10.1:8080 check
        server testhost2 10.10.10.2:8080 check backup disabled

backend testhost-grpc
	option http-use-htx
    description grpc
    server testhost1 11.11.11.1:50051 proto h2 track testhost/testhost1
    server testhost2 11.11.11.2:50051 proto h2 track testhost/testhost2 backup disabled

```

What could be the problem?  
Thanks in advance.
