Modify

Opened 15 years ago

Closed 15 years ago

#4070 closed defect (fixed)

404 Not Found error for `/wikicss.css`

Reported by: Oliver Metz Owned by: Martin Scharrer
Priority: normal Component: WikiCssPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Hi.

Though I can't see an error in trac.log I get a 404 for wikicss.css:

http://trac.freetz.org/wikicss.css

GET /wikicss.css HTTP/1.1
Host: trac.freetz.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Accept: text/css,*/*;q=0.1
Accept-Language: de
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://trac.freetz.org/wiki/SiteStyle
Cookie: trac_form_token=a11b422cedb4f56076561d94; trac_session=2aa97fb77df24e1b4bdc22fd
Cache-Control: max-age=0

HTTP/1.x 404 Not Found
Content-Length: 0
Date: Tue, 11 Nov 2008 13:27:35 GMT
Server: lighttpd/1.4.21

I'm using trac-0.11 stable-branch. The wikipage SiteStyle is created and filled with content. I'm delivering tracs static content directly by lighttpd. Can this cause this error?

Attachments (1)

wikicss_exception.patch (1.1 KB) - added by Oliver Metz 15 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 15 years ago by Martin Scharrer

Status: newassigned
Summary: WikiCssPlugin does not work404 Not Found error for `/wikicss.css`

I looks to me if lighttpd is catching the request, so it doesn't reach the request handler of the plug-in:

HTTP/1.x 404 Not Found
Content-Length: 0
Date: Tue, 11 Nov 2008 13:27:35 GMT
Server: lighttpd/1.4.21

Can you start trac without lighttpd and test if the error is still there? How is lighttpd configured to know what is static and what's dynamic content?

One solution might be to move the CSS "file" to an different location, e.g. from '/wikicss.css' to '/chrome/wikicss/wikicss.css' which has to be done in the plug-in code.

comment:2 Changed 15 years ago by Oliver Metz

Sorry for the bad summary. I should know it better...

I get the same error if I serve trac through tracd.

http://trac.freetz.org:8000/wikicss.css

GET /wikicss.css HTTP/1.1
Host: trac.freetz.org:8000
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Accept: text/css,*/*;q=0.1
Accept-Language: de
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://trac.freetz.org:8000/
Cookie: tracwysiwyg=textarea; trac_form_token=78b59f3fccb39ff93e53b277; trac_session=1c2ee27f9f2732a85049f441

HTTP/1.x 404 Not Found
Server: tracd/0.11stable-r7667 Python/2.5.2
Date: Wed, 12 Nov 2008 20:52:35 GMT
Server starting in PID 23592.
Serving on http://trac.freetz.org:8000/
90.228.209.240 - - [12/Nov/2008 21:59:45] "GET / HTTP/1.1" 200 -
90.228.209.240 - - [12/Nov/2008 21:59:46] "GET /chrome/common/css/trac.css HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:46] "GET /chrome/common/css/wiki.css HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:46] "GET /chrome/common/js/jquery.js HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:46] "GET /wikicss.css HTTP/1.1" 404 -
90.228.209.240 - - [12/Nov/2008 21:59:46] "GET /chrome/tracwysiwyg/wysiwyg.css HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:46] "GET /chrome/common/css/code.css HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:47] "GET /chrome/common/js/trac.js HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:47] "GET /chrome/common/js/search.js HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:47] "GET /chrome/tracwysiwyg/wysiwyg.js HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:48] "GET /chrome/tracwysiwyg/wysiwyg-load.js HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:48] "GET /chrome/common/trac_banner.png HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:48] "GET /chrome/common/trac_logo_mini.png HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:48] "GET /chrome/site/style.css HTTP/1.1" 404 -
90.228.209.240 - - [12/Nov/2008 21:59:49] "GET /chrome/common/topbar_gradient2.png HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:49] "GET /chrome/common/topbar_gradient.png HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:49] "GET /chrome/common/extlink.gif HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:49] "GET /chrome/common/dots.gif HTTP/1.1" 304 -
90.228.209.240 - - [12/Nov/2008 21:59:49] "GET /favicon.ico HTTP/1.1" 404 -
90.228.209.240 - - [12/Nov/2008 21:59:52] "GET /favicon.ico HTTP/1.1" 404 -

btw. lighttpd has an alias.url for "/chrome/" set to deliver static content

comment:3 Changed 15 years ago by Martin Scharrer

Make sure you have use the right settings, set the trac log file to DEBUG and look for warnings.

[components]
tracwikicss.* = enabled

[wikicss]
# configure wiki page to be used as CSS file as `[/projectdir]/wikicss.css`.
wikipage = SiteStyle

comment:4 Changed 15 years ago by Martin Scharrer

I checked it and it works for me as long the above settings are in place. There is no standard style page defined in the code, so you have to set it explicit.

I also added more error messages to the code. Install the latest version, try it again and have a look at you trac.log file.

Tell me if this fixes your problem (or helps you to fix your configuration).

comment:5 Changed 15 years ago by Oliver Metz

Thanks for your fast response. In attached patch you can see the (for me) needed changes. Now it's running...

  1. postgresql needs "GROUP BY" clause
  2. "cursor.fetchone()[0]" gives "ERROR: 'NoneType' object is unsubscriptable" if wikipage doesn't exist
  3. "execpt RequestDone: pass" otherwise there is an empty error message logged
  4. "req.send..." gives "Headers already set" error

Changed 15 years ago by Oliver Metz

Attachment: wikicss_exception.patch added

comment:6 in reply to:  5 Changed 15 years ago by Martin Scharrer

Replying to olistudent:

  1. postgresql needs "GROUP BY" clause

Yeah, I forgot that one, sqlite needs it probably too. I'm relative new to SQL.

  1. "cursor.fetchone()[0]" gives "ERROR: 'NoneType' object is unsubscriptable" if wikipage doesn't exist

I know, I was originally catching this and returned a "Wiki Page not found" message. Due to the changes from this morning this doesn't work any more as planned.

  1. "execpt RequestDone: pass" otherwise there is an empty error message logged

Right, forget about that.

  1. "req.send..." gives "Headers already set" error

IMHO this is because of 3., because the RequestDone exception in req.send(content... was taken as error exception and triggered the req.send_response(404). So fixing 3. should fix 4., too.

I applied most changes done by your patch except I didn't removed the req.send_response(404) etc.. Not sending any response might cause browsers to wait until a timeout occurs, which isn't polite HTTP.

Check it out and tell me if it is working properly.
Martin

PS: Please use proper wiki syntax: ` `, not " " for code and you need to place at least one white space before the numbered list, otherwise it will be displayed as running text.

comment:7 Changed 15 years ago by Oliver Metz

Resolution: fixed
Status: assignedclosed

Sorry again. Always telling my users to use the preview function... :-(

Everything seems to work fine now. No further errors in the logfile.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Martin Scharrer.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.