4 messages in ru.sysoev.nginxRe: Wrong mime type for xml feed?
FromSent OnAttachments
Ezra ZygmuntowiczSep 26, 2006 9:26 am 
Igor SysoevSep 26, 2006 1:18 pm 
Ezra ZygmuntowiczSep 26, 2006 1:34 pm 
Igor SysoevSep 26, 2006 1:40 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Wrong mime type for xml feed?Actions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Sep 26, 2006 1:40:12 pm
List:ru.sysoev.nginx

On Tue, 26 Sep 2006, Ezra Zygmuntowicz wrote:

On Sep 26, 2006, at 1:18 PM, Igor Sysoev wrote:

As I understand from your configuration, "/feed/atom.xml" may be handled by backend. And that request is really handled by backend: nginx never set the "ETag" header line, so the "Content-Type: text/plain" is set by backend too. nginx does not change the "Content-Type", so you need configure it on backend.

THanks for looking at it. I think its a bit more complex then that. The atom feed is served by a rails backend but is then cached on diskl and served by nginx until it gets expired again. Standard rails page caching setup. So when there is no file cached on disk yet, the first hit to the url gives this header:

rick@ricks-computer:~% curl -I http://mephistoblog.com/2006/8/31/how- s-immortus-treating-you/changes.xml HTTP/1.1 200 OK Server: nginx/0.4.0 Date: Tue, 26 Sep 2006 20:26:28 GMT Content-Type: application/xml Connection: keep-alive Status: 200 OK Cache-Control: no-cache Content-Length: 0

You can see the correct content type is being set here.

Now after that first hit, rails wrote the changes.xml file onto disk and the rewrite rules are set to serve static content first if it is present. So the second request to the same url gives a different header. And I double-checked the nginx log and rails log and this second request is definitely being served by nginx and not rails.

rick@ricks-computer:~% curl -I http://mephistoblog.com/2006/8/31/how- s-immortus-treating-you/changes.xml HTTP/1.1 200 OK Server: nginx/0.4.0 Date: Tue, 26 Sep 2006 20:26:32 GMT Content-Type: text/plain; charset=ISO-8859-1 Connection: keep-alive ETag: "45198cf4-12b7-743e4" Last-Modified: Tue, 26 Sep 2006 20:26:28 GMT Content-Length: 4791

I really appreciate your help. Can you see what the issue is?

It's strange, nginx can not set ETag. You can build nginx --with-debug, then add to nginx.conf:

error_log /path/to/log debug;

or

error_log /path/to/log;

events { debug_connection 192.168.1.1; debug_connection 192.168.1.0/24;

Using debug_connection you can debug only some addresses.