cabbagejs / cabbage

A CLI for building conventional web applications with Broccoli
MIT License
5 stars 0 forks source link

add server-proxying feature #13

Open searls opened 9 years ago

searls commented 9 years ago

Presumably there are hooks into the broccoli server?

searls commented 9 years ago

want to be sure we ship #14 first b/c it's simpler

searls commented 9 years ago

I started toying with this and #14 which necessitated I first start https://github.com/broccolijs/broccoli/pull/226

In the meantime it might be useful to point out that https://github.com/nodejitsu/node-http-proxy has had several API-breaking changes since Lineman was written, and we're going to have to revisit how the proxy was implemented as a result to ensure that headers are forwarded to the destination appropriately.

searls commented 9 years ago

^ in particular, this seems to not work spectacularly. It can get me to a Rails app, but that request fails almost immediately; I believe because there are no headers at all on the request:

httpProxy = require("http-proxy")
proxy = ->
  routingProxy = httpProxy.createProxy()
  return (req, res, next) ->
    routingProxy.proxyRequest req, res,
      target: "http://localhost:3000#{req.url}"