Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there any way to configure HAProxy to convert GET requests to POST when sending to the backend servers?

The background of the problem is that we want to use a Cloud based logging service (e.g. loggy.com), which only allows log events to be created via POST to its REST API. Log events will be created via Javascript in a browser when our widget is loaded onto webpages, thus we can't do POST because of CSRF prevention.

Is there a better way to do this besides setting up a proxy that converts GETs into POSTs?

share|improve this question

2 Answers 2

Something like this should do the trick:

backend HttpServers
  mode http
  balance roundrobin
  option httpchk
  reqirep ^GET\s+(https?:/.*)$ POST\ \1

The key bit is the last line.

share|improve this answer

I'd recommend against generating the events in javascript on the client browser, for a multitude of reasons, security foremost.

Work with the vendor you choose to determine the best way to bring your web server logs into the service, but grabbing out that text file instead of trying to get client browsers to send requests directly to the event API will make your life much easier.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.