Greg Reimer

Results 72 comments of Greg Reimer
trafficstars

> Which makes me think if it'll be of use to match regexes on other request/response fields too Interesting. What about a more general approach where, for any filtering option,...

It's buried in the [docs](http://greim.github.io/hoxy/#proxy-intercept), but yes, filtering options are logically ANDed together, and would definitely remain so if this new feature is added. ``` js proxy.intercept({ hostname: hostname =>...

Although, now that I think of it: ``` js proxy.intercept({ hostname: hostname => hostname.split('-')[1] url: '/user/:username/', }, function(req) { // if this interceptor callback is called, then... console.log(req.matches.hostname); // this...

> a condition that has to me met? Correct. The intent would be that `hostname => hostname.split('-')[1]` is just a conditional. It was probably a bad example. Maybe a better...

How would it know which domain to forward to?

I'm still not sure I follow. In reverse proxy mode, there's only one possible request hostname in the first place: the one declared in the `reverse` option. You could switch...

Agreed that it's best implemented as a separate module.

Have you tried `mimeType`? Ideally a server wouldn't use a json mime type in a 304 response, so you could do: ```js proxy.intercept({ phase: 'response', mimeType: /json/, as: 'json' },...

> I agree that the server shouldn't send a application/json mimeType for a 304, but unfortunately the server I'm working with tends to do just that, and I don't control...

You can get a status message using node's built in `http.STATUS_CODES`. https://nodejs.org/dist/latest-v4.x/docs/api/http.html#http_http_status_codes