Title | downloading attachments doesn't work when using apache with mod_jk |
Date | 03-Feb-2005 19:04:07 EET |
Version | 2.1.134 |
Submitter | 193.75.212.66 |
Bug criticality | MediumBug |
Browser version | Firefox |
Bug status | ClosedBug |
PageProvider used | |
Servlet Container | tomcat 4 |
Operating System | Linux |
URL | attach |
Java version | 1.4 |
Upgraded from 1.8 to 2.1.134. Works ok except for attachments. We are using an Apache Httpd server in front of tomcat (mod_jk). If we connect to the http connector of tomcat, we can download attachments. But if we try to access the attachments through apache, we get a 404 Not found.
Are you sure all /attach/ -URLs are mounted using the JkMount directive?
JkMount /attach/* ajp13
OR, just say JkMount /* ajp13 to make Tomcat handle everything.
Done some more research. Increased mod_jk loglevel. I have found something weird. When I hover over a link to an attachment. I see in my browser that the link points to eg "attach/Linux/ks.cfg". When I click on the link, I get a 404 but the url in the address bar is "attach/Linux%2Fks.cfg". If I replace "%2F" with "/" in the address bar of my browser I can download the attachment just fine. If i open the source of the html file, I find <a class="attachment" href="attach/Linux%2Fks.cfg">ks.cfg</a>.
If I use the Tomcat http connector, I can download the attachment with either uri (attach/Linux/ks.cfg and attach/Linux%2Fks.cfg). I hope this helps.
-- da
Ah, now I see. Please upgrade to the latest CVS version, it should have this bug fixed. Please report if it works for you.
Downloaded JSPWiki-latest.zip and installed it, unfortunately the problem is not solved.
-- da
This is strange. I use Firefox + Linux (or Safari + OSX) in all my development and it works perfectly. jspwiki.org runs on Apache+Tomcat, and attachment loading seems to work perfectly as well. I am unable to replicate this bug, please try and give more information...
Yes, I confirm that this bug appears on Apache+Tomcat setup, even with a very latest build. However, the root of the problem is somewhere else, not in the setup, I guess. When I set jspwiki.encoding to UTF-8, everyhting works fine. It only appears to strike with ISO-8859-1. So it has to be WikiEngine.encodeName(String) using java.net.URLEncoder that causes the problem. In particular, "/" is replaced by "%2F" in a construct like "CurrentPageName/MyAttachment.png" that is passed to be encoded. I also was able to fix it by replacing "%2F" back to "/" after java.net.URLEncoder returns. And this hack looks ugly. So, probably, your idea to have proprietory urlEncode in TextUtil is still the best option.
-- AlexPakka
We are using JSPWiki 2.2.28, Apache 2/Tomcat 5.5/JDBC attachment provider. Attachments can be selected, but on clicking upload after a while a message appears: "Not Found - The requested URL /Wiki/Lias/attach was not found on this server." In our situation the information is inside the Apache httpd.conf file (not in a separate mod_jk.conf file as assumed in an answer in WikiAttachments).
We tried to insert:
JkMount /*.jsp ajp13w
JkMount /Wiki/*/attach/* ajp13w
It seems that even when using the JDBC attachment provider, a folder "attach" is required.
but it only seems to solve part of the problem. The error message changes to "HTTP Status 404 - Attachment 'Main', version -1 does not exist." generated by Tomcat.
-- Gregor Hagedorn
Make also sure that you also have the correct mappings in your web.xml (this is the default, your config may vary):
<servlet> <servlet-name>AttachmentServlet</servlet-name> <servlet-class>com.ecyrd.jspwiki.attachment.AttachmentServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>AttachmentServlet</servlet-name> <url-pattern>/attach/*</url-pattern> </servlet-mapping>
A folder named "attach" should never be required; the problem is that even if you tell Apache that all requests to /attach/ should be directed to Tomcat; you also need to tell Tomcat which servlet takes care of the things.
I also don't think you can use wildcards in the middle of your JkMount directives... There's something strange going on all right - perhaps the attach URLs are not generated correctly? If your JSP files are at /wiki/*.jsp, your attach url should be /wiki/attach/*
See also AttachDirNotFound.
Gregor? Is it working? Can I close this?
-- JanneJalkanen, 21-Feb-2006
Hello, I am experimenting with JSPwiki 2.4.53. I also found with latest JSPwiki 2.4.53 that german characters, like ä-ö-ü-ß, do not work. It means Search panel returns back search string broken (UTF problem?) on the places where ä-ö-ü-ß originally were. Same problem with attachments where file names have same characters. In this case, Tomcat (5.5.17) generates failure like "file cannot be found". Nevertheless, all links to articles with ä-ö-ü-ß work absolutely fine, no problems with unknown page or something like that. Can anybody help?
-- Chelex, 09-Oct-2006
OK, my problem is solved. Everywhere where connector configured, in server.xml from tomcat, it must be configured (add one line, actually) also with URIEncoding="UTF-8". On each port, like 8080, 8443, 8009.
-- Chelex, 09-Oct-2006