Skip to content

Apache module to forward requests to a grpc backend

License

Notifications You must be signed in to change notification settings

Thalhammer/mod_grpcbackend

Repository files navigation

mod_grpcbackend

This module provides a way for apache to directly interact with a grpc backend service. Using this you can add a webinterface to your grpc service without any additional libraries or complex configuration.

Building

In order to build mod_grpcbackend on your system you need to install some required packages:

  • build-essential
  • protoc
  • libprotobuf
  • libgrpc++
  • apache2-dev

If you have installed all required software checkout this repository and run

make

make install

and add the following line somewhere in your apache config:

LoadModule grpcbackend_module /usr/lib/apache2/modules/mod_grpcbackend.so

Configuration

Currently mod_grpcbackend provides only 4 configuration directives, but only 2 are required for a working configuration. In addition to enabling grpcbackend using GrpcEnabled you need to set the handler to grpcbackend if you want a file to get handled by grpcbackend. See SetHandler and AddHandler for more information.

GrpcEnabled Directive

If you want a directory to be handled by a grpc backend, you need to set this directive to on.

GrpcHost Directive

This allows you to set the grpc service host and port apache will forward your requests to.

GrpcConnectTimeout Directive

This optional directive allows you to set a timeout in milliseconds for connecting to your backend service.

GrpcCallTimeout Directive

This optional directive allows you to set a timeout in milliseconds for each call to your backend service.