[updated below]
I have a bit of a problem deploying a site on apache with mod_wsgi with some javascript bookmarklet functionality; alpha site is up and usable here: stemhub.org. The problem is that the bookmarklet (which is a browser menu button) submits to a page like
http://stemhub.org/submit/http://the-users-link.com/here
which then returns a form to save metadata about the link. The view function (a flask/werkzeug app) checks the database to see if the link has already been added, then returns the form with an either pre-existing or newly assigned link id, which I suppose could trigger some kind of timing problem. Very strangely, when I first submit the link, i get the http://stemhub.org/submit/http://the-users-link.com/here
page with a "not found" apache error, but if I then reload the page, I get the form as intended. Error logs contain messages about threading exceptions, but they do when the site perfoms as expected, too.
There is a parallel deployment of the app on another port -- stemhub.org:5000 -- that is running on Tornado and works fine, as well as the local development version.
Here are the bookmarklets, on the chance they are the problem:
working port 5000 version: javascript:(function(){window.open('http://stemhub.org:5000/submit/'+encodeURIComponent(window.location.href),'height=200,width=150')}())
problem port 80 version:javascript:(function(){window.open('http://stemhub.org/submit/'+encodeURIComponent(window.location.href),'height=200,width=150')}())
UPDATE: For some reason that belongs to another tag changing the javascript method encodeURIComponent
to encodeURI
makes everything work as intended, at least in FF and Chrome. Will take Graham Dumpleton's advice about something more sensible for this in the future however.