On Friday, February 14, 2014 12:36:47 AM UTC-8, greelgorke wrote:
>
> according to this 
> https://github.com/visionmedia/send/blob/master/lib/send.js#L450-L457  
> static middleware tries to set it. you could, however app.use another 
> middleware before static in wich you can set the header yourself.
>

That link shows a function that would try to set the Content-Type if that 
function was called.  For whatever reason, that function is clearly not 
getting called. I can see that it checks for whether the request had that 
header, and I've verified in Firefox that my requests are not setting that 
header, so that's not the problem.

What sort of middleware could I use before static that would set the header?

Is there any way to turn on additional debugging for node and/or express 
that might provide more information about why it's not setting the 
Content-Type header?


> Am Freitag, 14. Februar 2014 03:04:10 UTC+1 schrieb David Karr:
>>
>> 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.

Reply via email to