kbonnelly kbonnelly - 4 months ago 36
Apache Configuration Question

How can Apache (maybe Tomcat) redirect to a specific file

I have a reverse proxy that points to a server with a specific port number (ex. 8443). On that server, we have a running Tomcat that listen to that port using HTTPS. This port have some mapping set to different services (ex. " https://myURL.com/myApp/api/myService").

What I would like to do is having Tomcat to also redirect to a file. Example: https://myURL.com/myApp/download/file12354.exe points to \myServer\files\file12354.exe

My question is: Is is possible to do that from Tomcat configurations or should I setup a normal Apache Web Server that redirects to a Tomcat when url = /api/ and to a file when /download/ ?

The files may be over 4GB each and the server is on Windows Server 2012.


I found a way to do that.

I am now streaming the file byte by byte directly from tomcat and my tablet is downloading it with HttpsURLConnection.

InputStream is = new FileInputStream(myFile);
OutputStream os = response.getOutputStream();
while((count = is.read(buffer)) != -1){                 

This works for small files. I still have some problems with SocketTimeoutException.