But nginx set content type based on requested url, not on delivered file, isn't a bug.<br>Could you change the url to /client.js ? <br>Tthis will solve everything, you will not have to set the default_type.<br><br><div class="gmail_quote">
On Wed, Oct 24, 2012 at 9:52 AM, Tom van der Woerdt <span dir="ltr"><<a href="mailto:info@tvdw.eu" target="_blank">info@tvdw.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Yes, that's the URL I am using. Using
default_type is possible but it still feels like a bug, especially
since the actual file it's serving does end with .js. I know it's
possible with a rewrite but that also feels like a hack instead of
a real solution, especially since the file I'm serving is outside
the website's root folder.<span class="HOEnZb"><font color="#888888"><br>
<br>
Tom</font></span><div><div class="h5"><br>
<br>
<br>
On 10/24/12 1:44 PM, Wandenberg Peixoto wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">Just to be clear, are you calling "<a href="http://example.com/client" target="_blank">example.com/client</a>"
and serving a js file?<br>
If yes, this is the problem, the mime types works based on
requested filename extension, if I am not wrong.<br>
As you called /client the nginx don't know what mime type to
deliver.<br>
So, or you have too use the default_type on that location, or
change the request to something like /client.js, <br>
or do a rewrite from /client to the js insted of use a location to
that.<br>
<br>
<div class="gmail_quote">On Wed, Oct 24, 2012 at 8:05 AM, Tom van
der Woerdt <span dir="ltr"><<a href="mailto:info@tvdw.eu" target="_blank">info@tvdw.eu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Yes, this is in my nginx.conf file :<br>
<br>
http {<br>
include mime.types;<br>
default_type application/octet-stream;<br>
<br>
{more}<br>
<br>
include /etc/nginx/conf.d/*.conf;<br>
}<br>
<br>
Tom<br>
<br>
<br>
Op 10/24/12 12:00 PM, Wandenberg Peixoto schreef:<br>
</div>
<div>
<div>
<blockquote type="cite">Are you using a mime.types file?
Or setting types block?<br>
This file has a mapping from file extension to the
content type, may be what is missing on your
configuration.<br>
<br>
<div class="gmail_quote">On Wed, Oct 24, 2012 at 6:59
AM, Tom van der Woerdt <span dir="ltr"><<a href="mailto:info@tvdw.eu" target="_blank">info@tvdw.eu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Thanks, that works, but it doesn't really
sound like a solution, more like a workaround.<br>
<br>
Tom<br>
<br>
<br>
Op 10/24/12 5:04 AM, Wandenberg Peixoto
schreef:<br>
</div>
<div>
<div>
<blockquote type="cite">Try to set<br>
<br>
default_type text/javascript;<br>
<br>
instead of add_header.<br>
<br>
Regards,<br>
Wandenberg<br>
<br>
<div class="gmail_quote">On Tue, Oct 23,
2012 at 9:50 PM, Tom van der Woerdt <span dir="ltr"><<a href="mailto:info@tvdw.eu" target="_blank">info@tvdw.eu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I'm using nginx' locations to serve a
javascript file on '/client' :<br>
<br>
location = /client {<br>
expires epoch;<br>
alias /path/to/a/file.js;<br>
}<br>
<br>
Works fine, with one major exception:
it gets an octet-stream Content-Type
header. I tried to solve this with :<br>
<br>
add_header Content-Type
text/javascript;<br>
<br>
Now I get two Content-Type headers.<br>
<br>
The raw response:<br>
<br>
< HTTP/1.1 200 OK<br>
< Server: nginx/1.3.6<br>
< Date: Tue, 23 Oct 2012 23:42:27
GMT<br>
< Content-Type:
application/octet-stream<br>
< Content-Length: 23245<br>
< Last-Modified: Sat, 20 Oct 2012
00:09:12 GMT<br>
< Connection: keep-alive<br>
< ETag: "5081eba8-5acd"<br>
< Expires: Thu, 01 Jan 1970
00:00:01 GMT<br>
< Cache-Control: no-cache<br>
< Content-Type: text/javascript<br>
< Accept-Ranges: bytes<br>
<br>
nginx information :<br>
<br>
nginx version: nginx/1.3.6<br>
built by gcc 4.4.6 20120305 (Red Hat
4.4.6-4) (GCC)<br>
TLS SNI support enabled<br>
configure arguments: --user=nginx
--group=nginx --with-http_ssl_module
--with-http_gzip_static_module
--with-http_secure_link_module
--with-http_realip_module
--with-http_stub_status_module
--with-ipv6
--with-openssl=/root/libraries/openssl-1.0.1c/
--prefix=/etc/nginx/
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp<br>
<br>
Server information :<br>
<br>
Linux hostname.goes.here
2.6.32-279.5.2.el6.centos.plus.i686 #1
SMP Thu Aug 23 22:13:33 UTC 2012 i686
i686 i386 GNU/Linux<br>
<br>
It's not a major issue for me
(browsers will accept octet-stream
just fine) but might be annoying for
other people, should they ever run
into this.<br>
<br>
Tom<br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote>
</div>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
nginx-devel mailing list
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote>
</div>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
nginx-devel mailing list
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote>
</div>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
nginx-devel mailing list
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br></blockquote></div><br>