On Tue, 2008-05-20 at 21:24 +0300, Janne Jalkanen wrote: > It sounds like you're accessing it with "localhost" *even* when your > baseURL is set to something else. > > Don't do that. Always access your wiki with the baseURL you have > given it, never via an alias. Otherwise, browser security kicks in > and you will e.g. lose cookies, which will destroy your session, > which in turn will destroy your editing and *especially* previews. > > So, if > > baseURL = localhost:8080/wiki, then use http://localhost:8080/wiki > > if > > baseURL = 127.0.0.1:8080/wiki, then use http://127.0.0.1:8080/wiki - > *NOT* localhost. There is no reason for the browser to consider > localhost and 127.0.0.1 to be the same address. > > if > > baseURL = 192.168.0.10:8080/wiki, then use http://192.168.0.10:8080/ > wiki to access it - NOT localhost or 127.0.0.1, even if they resolve > to the same address, that is, it is your own computer. > > We can't prevent this, but we *could* check the Host header, and > force a redirect if you're using the wrong URL. Though that might > cause some havoc in some intranet setups.
No, that is not the case. In connecting to the remote computer (my case #1 as described below) I'm doing precisely what you recommend above, and the browser, upon exit from the editor, is indeed shifting to "localhost". My guess is that it's encountering a relative url (that is, not using the baseURL). I believe that, when it doesn't know what to do, the browser uses "localhost." Similarly, in my case #2, even if I access the locally hosted JSPWiki with the actual IP address (that is, using the baseURL), the browser DOES still switch to the "localhost" address format upon leaving the editor. Again, I note that the ONLY time this happens is upon exit from the editor using 'Cancel' or 'Save'. Also, as I mentioned earlier, and just to make things more confusing, the 'Preview' option seems to work without changing the url. > > /Janne > > On 20 May 2008, at 19:41, Terry Steichen wrote: > > > The problem is now a bit more clear. > > > > 1) when my browser is running on one machine and JSPWiki is running > > on a > > DIFFERENT machine (using a non-default port - 8080), exiting the > > editor > > (via 'Save' or 'Cancel') causes my browser (either Firefox or IE) > > to get > > a page not found fault, because the browser tries to change the url > > from > > "http://remote_address/app_name/Wiki.jsp?page=xx" to > > "http://localhost/app_name,Wiki.jsp?page=xx" > > > > 2) when my browser is running on the SAME machine as is hosting > > JSPWiki > > (my normal set up), this redirection works fine in Firefox. > > However, IE > > doesn't (for some reason) respond to "localhost"; rather I have to use > > something like "127.0.0..1" to get it to work right in the first > > place. > > When it is redirected to "localhost" it refuses. > > > > 3) When the application is running on a host that is accessed via the > > default port 80 (as with a hosting service), everything seems to work > > the way it should (for both Firefox and IE). This suggests that the > > non-default port number might be getting lost somewhere in JSPWiki. > > > > The baseURL I'm using is http://192.168.15.103:8080/TC4 (TC4 is the > > application name.) > > > > Not sure where to go from here. Maybe someone who's more familiar > > with > > the way that baseURL works could give some suggestions. > > > > PS: I did a bit of tracing of the HTML interactions using TCPTunnel. > > The header-related output of that debugging is (and note the 302 > > declaration - Moved Temporarily - in the last server response): > > > > > > > > ====================================================================== > > Browser request to load page in editor: > > > > ====================================================================== > > GET /TC4/Edit.jsp?page=Small HTTP/1.1 > > Host: localhost > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: > > 1.8.0.12) > > Gecko/20071126 Fedora/1.5.0.12-7.fc6 Firefox/1.5.0.12 pango- > > text > > Accept: text/xml,application/xml,application/xhtml > > +xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > 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://localhost/TC4/Wiki.jsp?page=Small > > Cookie: JSPWikiAssertedName=Terry+Steichen; > > JSPWikiUserPrefs=%7B > > %22PrevQuery%22%3A%22%22%7D; > > JSESSIONID=717E8D634E2B8F2F579149899244C429 > > If-Modified-Since: Tue, 20 May 2008 15:36:38 GMT > > > > > > > > > > POST /TC4/JSON-RPC HTTP/1.1 > > Host: localhost > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: > > 1.8.0.12) > > Gecko/20071126 Fedora/1.5.0.12-7.fc6 Firefox/1.5.0.12 pango- > > text > > Accept: text/xml,application/xml,application/xhtml > > +xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > Content-Type: text/plain > > Content-Length: 55 > > Cookie: JSPWikiAssertedName=Terry+Steichen; > > JSPWikiUserPrefs=%7B > > %22PrevQuery%22%3A%22%22%7D; > > JSESSIONID=717E8D634E2B8F2F579149899244C429 > > Pragma: no-cache > > Cache-Control: no-cache > > > > {"id": 1, "method": "system.listMethods", "params": > > []}POST /TC4/Edit.jsp?page=Small HTTP/1.1 > > > > > > > > > > > > > > ====================================================================== > > Server response to editor request: > > > > ====================================================================== > > ======= > > HTTP/1.1 200 OK > > Server: Apache-Coyote/1.1 > > Cache-control: max-age=0 > > Expires: Tue, 20 May 2008 15:40:57 GMT > > Last-Modified: Tue, 20 May 2008 15:40:57 GMT > > Content-Type: text/html;charset=UTF-8 > > Transfer-Encoding: chunked > > Date: Tue, 20 May 2008 15:40:57 GMT > > > > 2000 > > > > > > > > ====================================================================== > > Browser request to cancel in editor: > > > > ====================================================================== > > =========== > > Host: localhost > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: > > 1.8.0.12) > > Gecko/20071126 Fedora/1.5.0.12-7.fc6 Firefox/1.5.0.12 pango- > > text > > Accept: text/xml,application/xml,application/xhtml > > +xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > 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://localhost/TC4/Edit.jsp?page=Small > > Cookie: JSPWikiAssertedName=Terry+Steichen; > > JSPWikiUserPrefs=%7B > > %22PrevQuery%22%3A%22%22%7D; > > JSESSIONID=717E8D634E2B8F2F579149899244C429 > > Content-Type: application/x-www-form-urlencoded > > Content-Length: 144 > > > > page=Small&action=save&encodingcheck=%E3%81% > > 81&cllcjd=1212066831392&cancel=Cancel&_editedtext=Small+is > > +beautiful.%0D%0A&submit_auth=&changenote= > > > > > > > > > > ====================================================================== > > Server response to editor 'cancel' request: > > > > ====================================================================== > > ============ > > HTTP/1.1 200 OK > > Server: Apache-Coyote/1.1 > > Content-Type: text/plain;charset=utf-8 > > Content-Length: 112 > > Date: Tue, 20 May 2008 15:40:57 GMT > > > > {"result": > > ["search.getSuggestions","progressTracker.getProgress","users.getUserI > > nfo","search.findPages"],"id":1}HTTP/1.1 302 Moved Temporarily > > Server: Apache-Coyote/1.1 > > Cache-control: max-age=0 > > Expires: Tue, 20 May 2008 15:41:13 GMT > > Last-Modified: Tue, 20 May 2008 15:41:13 GMT > > Location: http://localhost:8080/TC4/Wiki.jsp?page=Small > > Content-Type: text/html;charset=UTF-8 > > Content-Length: 0 > > Date: Tue, 20 May 2008 15:41:13 GMT > >
