1

I'm writing a server and I need to forward along a certain Request message. This message is basically either a POST (or GET) message, possibly containing a file of a few megabytes. This message is forwarded to another server that actually stores (or retrieves) the file.

I'm using the Yesod framework. So, using getWaiRequest, I can get a WAI Request. But to initiate a new message to pass along, I need to use the Network.HTTP.Conduit for its laziness. So I need to make a Request m in that module. But I have no clue how to do this conversion. WAI's Request is simply a data type, but Conduit's is a Request m type, so I kept getting error messages trying to copy stuff over.

Can somebody tell me how I do this? If not, how I can just pass along the WAI Request to another server without using HTTP Conduit would be just as good.

Thanks!

Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
Victor
  • 584
  • 4
  • 16

1 Answers1

2

The two request types are incompatible. You need to convert between them manually. WAI is not really suitable for proxying. The easiest option is to configure your front HTTP daemon to forward the corresponding URLs right away without ever sending them to your Yesod application.

ertes
  • 21
  • 1