On Thursday, February 13, 2014 6:04:10 PM UTC-8, David Karr wrote:
>
> 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?
>

I've concluded that Node/Express is setting the Content-Type.  
Nevertheless, the page served from Node into Firefox is semi-brain-dead, 
resulting in Firefox not loading the javascript files.  I don't have this 
problem when the files are served by WebLogic, and I don't see this problem 
in Chrome, no matter whether the files are served by Node or WebLogic.

The only significant difference I see in the response headers is actually 
in the Content-Type value sent by Node.  This is what I see from Node and 
WebLogic:

* Node: text/html; charset=UTF-8
* WebLogic: text/html

I have no idea whether this is significant.

-- 
-- 
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.

Reply via email to