mozilla / playdoh

PROJECT DEPRECATED (WAS: "Mozilla's Web application base template. Half Django, half awesomeness, half not good at math.")
BSD 3-Clause "New" or "Revised" License
710 stars 107 forks source link

WSGI issue #143

Closed mathjazz closed 11 years ago

mathjazz commented 11 years ago

My Playdoh-based app works as expected on development server.

But when I visit the following URL (on production server): http://domain.com/%3A%2F

It triggers Apache error (instead of Django 404 error): Not Found The requested URL /:/ was not found on this server. Apache/2.2.15 (CentOS) Server at pontoon-dev.mozillalabs.com Port 80

It seems like WSGI doesn't work as expected.

mathjazz commented 11 years ago

It's the same here:

https://mozillians.org/%3F%2F https://l10n.mozilla.org/%3A%2F https://reps.mozilla.org/%3A%2F

fwenzel commented 11 years ago

The requested URL /:/ was not found on this server.

I think you mean /?/

Still, interesting bug. Possibly an issue with our standard apache configs?

jsocol commented 11 years ago

I just tested this with the Django dev server and nginx. The problem is definitely with Apache/mod_wsgi not forwarding the request. It's not an issue with Django or playdoh, so there's nothing to fix here.

adngdb commented 11 years ago

The default configuration of Apache doesn't allow encoded slashes %2F in URLs. In Socorro, we had this problem when calling our middleware API with signatures containing slashes. We ended up encoding each slash twice in the UI, and then decoding them twice in the middleware.

For example, /search/signature/operator%2F becomes /search/signature/operator%252F before we call that URL, and in the middleware we do str.replace('%2F', '/') on the signature parameter (that we know can contain double-encoded slashes).

You can also change Apache's config to allow encoded slashes. We didn't do it because we thought they had a good reason not to allow it, but we didn't make any deep research on what the risks were.

fwenzel commented 11 years ago

This is interesting stuff (thanks for teaching us something, @AdrianGaudebert), but this is pretty far outside a Playdoh bug, so I am going to close it. Thanks!

mathjazz commented 11 years ago

Thank you guys for explanations!