Avatar billede fredand Forsker
27. oktober 2013 - 14:34 Der er 5 kommentarer

Download zip-file-problem with IE 8 and Apache

Hello Guys!

I got a problem with IE 8 and downloading a zip-file from a <a href...>-tag.

The zip-file is included ina a war file that is in a ear file.

The ear-file is deployed at a JBoss 5.0.

How ever, everything works fine at my developer-environment. And I have also asked a colleuge to access the app at my JBoss with his IE 8 and that works fine for him as well to download the zip.

But when we deploy the ear at a JBoss in a testing-environment it does not work. The differens is that the testing-environment is fronted by a Apache-webserver. So my guess is that the Apache blocks it in some way. We only get a pop up saying the IE can not download this file or resource (if I remember correct). We have tried to also add some <a href...>-tags for images and text files, those links works fine (the IE 8 displays the content).

What do you think guys, is this some Apache-webserver-config issue?

Since we are in a hurry some other way of downloading the resource is also acceptable! I was thinking of some way to just put the zip-file in some folder in the JBoss for static resources, but I have not found any documentation for that when I just took a quick search on google.

So if you guys got any ideas please let me know!

Best regards!
/Fredrik (from sweden, feel free to answer in danish)
Avatar billede arne_v Ekspert
27. oktober 2013 - 14:47 #1
Check the link in the href attribute as seen in the browser.

In the setup:

browser----Apache httpd----Tomcat or JBoss with embedded Tomcat or similar

It is important that the HTML generated in the app server outputs a link that is valid not for the app server but for Apache httpd.

Relative URL's are easy.

But absolute URL's can be tricky.

Let us assume that:
- Apache httpd expose http://foobar.se/test
- app server expose http://barfoo.se/test

Then a full generated URL must be http://foobar.se/test not http://barfoo.se/test !

That is almost impossible to get working properly in multiple dev, test and prod environments.

So you should try and rewrite to use relative URL.

If that is not possible then rewrite to use only absolute path without hostname *and* make sure that Aoache httpd does not rewrite path.
Avatar billede fredand Forsker
27. oktober 2013 - 15:01 #2
Hello Arne!
Thanks for your very fast reply!
This sounds really interesting! Unfortenately I'm at home right now. But I think that the a-href-tag is like this in side a jsp-file
<a href="schemas/base.zip">Schemas</a>

To me this looks like a relative URL?
You said that "only absolute path without hostname ". I would guess that a absolute path contains the hostname? Could you give me an example of wjhat you think of a absolute path? (Or do I understand it wrong?)

Tomorrow I will take a look at the html, and try to paste the absolute url in the URL-adress-field.

(An other thing I recall is that a other colleuge said that I got it to work with FireFox).

So perhaps the apcahe-server rewrites the URL but way?
Is there a reason for that?

Best regards
Fredrik
Avatar billede arne_v Ekspert
27. oktober 2013 - 15:18 #3
You van have  apath starting with /.

For http://barfoo.se/app/jsp/something.jsp:

schemas/base.zip becomes http://barfoo.se/app/jsp/schemas/base.zip

/schemas/base.zip becomes http://barfoo.se/schemas/base.zip
Avatar billede arne_v Ekspert
27. oktober 2013 - 15:19 #4
But if you have access to the systems and:
* check the link in browser view source
* check Apache access log to see what request it receives
* check app server access log to see what request it receives
then I am pretty sure that you can work out what is going on.
Avatar billede fredand Forsker
30. oktober 2013 - 07:26 #5
Hello Arne!

First of all, mange tak, I learned alot from your posts!
It turned out that the problem was this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;316431

So the solution was to config the Apache so it removed the Pragama and Cache-Control for files ending with "zip"

But please leave an answer so I could reward you since your answer leraned and explain the realative-path function.

Best regards
Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Uanset kodesprog, så giver vi dig mulighederne for at udvikle det, du behøver.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester