I've written a simple server script that is intended to be used as a tool
for front-end developers to shorten their dev cycle. It serves all local
files, but proxies calls to a web service to an external domain. It uses
"express" to serve static files and "http-proxy" to proxy the web services.
This works fine when used with Chrome. However, when used with Firefox, it
seems to load the files, but doesn't know what to do with them. I narrowed
this down to the fact that Node isn't setting the "Content-Type" header on
the files it sends to the browser. Chrome is ok with this, because
apparently it intuits a guess based on the file content. Firefox doesn't
do that. I also assembled the app with our full build script and deployed
it to WebLogic, and that works fine in both Chrome and Firefox, as WebLogic
sets the Content-Type properly.
This is my simple script:
var express = require('express');
> var httpProxy = require('http-proxy');
>
> var app = express();
>
> var proxy = new httpProxy.createProxyServer({});
>
> app.use(app.router);
> app.use("/", express.static(__dirname));
>
> app.all('/FooService/*', function(req, res) {
> "use strict";
> return proxy.web(req, res, {
> target: "http://otherhost:port"
> });
> });
>
> app.listen(8000);
>
>
Is this a known problem with "express"? Is there a simple workaround, or
do I have to do this very differently?
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.