Edgewall Software

Opened 18 years ago

Last modified 10 years ago

#2531 closed defect

Reconstruction of absolute URL fails in a proxy setup — at Version 8

Reported by: tom@… Owned by: Jonas Borgström
Priority: high Milestone:
Component: general Version: 0.9.3
Severity: major Keywords: Federal Judge Limits Access to Cellphone Data washingtonpost.com/wp-dyn/content/article/2008/09/11/AR2008091103292.html
Cc: jberry@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christopher Lenz)

(ticket changed direction somewhat since original submission, see below)

checked that user running trac (www) has write access to the attchments folder.

Traceback (most recent call last):
  File "/usr/local/lib/python2.4/site-packages/trac/web/standalone.py", line 303, in _do_trac_req
    dispatch_request(path_info, req, env)
  File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 139, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 107, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.4/site-packages/trac/attachment.py", line 265, in process_request
    self._do_save(req, attachment)
  File "/usr/local/lib/python2.4/site-packages/trac/attachment.py", line 295, in _do_save
    upload = req.args['attachment']
  File "/usr/local/lib/python2.4/cgi.py", line 559, in __getitem__
    raise KeyError, key
KeyError: 'attachment'

Change History (8)

comment:1 by tom@…, 18 years ago

hmm.. here it works fine… perhaps it's our setup? but what else could factor in?

comment:2 by Christopher Lenz, 18 years ago

Milestone: 0.9.30.9.4

This would mean that the form submission doesn't contain the file upload itself… which I've never encountered or heard of myself.

comment:3 by tom@…, 18 years ago

Well, we haven't modified any templates, just the footer lines etc. in the .ini file. I have meanwhile been able to reproduce the error on a different machine, as well.

It's quite troubling for us, really.

The two things in common with those setups is that I've installed trac 0.9.2 via the freebsd ports collection.

I don't know anything about trac's inner workings yet, could you please elaborate on your above comment? I'm really anxious to get this fixed and will do whatever I can to help get this resolved. Let's not drop the ball on this one, if possible ;-)

comment:4 by tom@…, 18 years ago

Cc: Christopher Lenz added
Component: ticket systemgeneral
Summary: adding attachment to ticket produces attachment KeyErroradding attachment to ticket or wiki produces attachment KeyError
Version: 0.9.20.9.3

updating to 0.9.3 brought no relief :-( The error also occurs when attempting to add attachments to a wiki page.

I did find out, though, that the error does not occur, when I access trac directly (I'm running tracd on port 8000 and have apache to a proxypass)

perhaps apache is somehow the culprit? afterall, the form in question does contain the input field attachment.

Here's my VirtualHost entry, perhaps that will help:

    ProxyPass / http://intern:8000/
    ProxyPassReverse / http://intern:8000/

comment:5 by tom@…, 18 years ago

Resolution: fixed
Status: newclosed

okay, I resolved the issue for me personally, by using mod_python instead of tracd/mod_proxy…

still strange, though…

comment:6 by Matthew Good, 18 years ago

Resolution: fixed
Status: closedreopened

This should be worksforme

comment:7 by Matthew Good, 18 years ago

Cc: Christopher Lenz removed
Milestone: 0.9.4
Resolution: worksforme
Status: reopenedclosed

comment:8 by Christopher Lenz, 18 years ago

Description: modified (diff)
Milestone: 0.9.5
Priority: normalhigh
Resolution: worksforme
Status: closedreopened
Summary: adding attachment to ticket or wiki produces attachment KeyErrorReconstruction of absolute URL fails in a proxy setup

This issue has come up a number of times again, and I think I finally know the culprit now: we shouldn't be trying to extract the X-Forwarded-Host header and use that for reconstructing the absolute URL. The proxy (e.g. mod_proxy_http) actually expects the host name of the original machine, and will replace that with it's own host name.

We'll include the simple fix for this in 0.9.5.

Note: See TracTickets for help on using tickets.