# WEBrick and swf files

**URL:** <https://www.ruby-forum.com/t/webrick-and-swf-files/80139>\
**Category:** Ruby\
**Created:** [December 21, 2006, 5:46pm UTC](https://www.ruby-forum.com/t/webrick-and-swf-files/80139 "2006-12-21T17:46:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 21, 2006, 5:46pm UTC](https://www.ruby-forum.com/t/webrick-and-swf-files/80139/1 "2006-12-21T17:46:50Z")

</div>

Hi, I am having trouble getting Mozilla firefox to load a swf file  
served from WEBrick. When I access the same file from another web  
server in firefox, it works fine (apache, abyss, etc)

When I access the file from Internet Explorer 6 (served from WEBrick),  
the swf file loads fine. When I try from firefox, I am asked if I want  
to download the file.

Here is what WEBrick logs when it serves the file:

localhost - - [21/Dec/2006:10:11:22 CST] “GET /hello.lzx.swf HTTP/1.1”  
304 0

I checked in firefox options and it has swf files listed to be opened  
with shockwave flash. I also added “swf” =\>  
“application/x-shockwave-flash” as a mime type in webrick (added to  
httputils.rb)

I am a bit green at these finer points of HTTP so if anyone has a  
suggestion or possible solution, I’d greatly appreciate it, as I’d hate  
to have to use Internet explorer for this particular app. I’d also  
like to use WEBrick to serve the application.

Thanks in advance,  
Eric

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 21, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/webrick-and-swf-files/80139/2 "2006-12-21T18:57:03Z")

</div>

\<…\>

> When I access the file from Internet Explorer 6 (served from WEBrick),  
> the swf file loads fine. When I try from firefox, I am asked if I want  
> to download the file.
> 
> Here is what WEBrick logs when it serves the file:
> 
> localhost - - [21/Dec/2006:10:11:22 CST] “GET /hello.lzx.swf HTTP/1.1”  
> 304 0

Status code 304 “Not modified” means that server has the same version  
of the file  
as browser in it’s cache. So in this case file won’t be served and  
browser will use  
cached version.

> I checked in firefox options and it has swf files listed to be opened  
> with shockwave flash. I also added “swf” =\>  
> “application/x-shockwave-flash” as a mime type in webrick (added to  
> httputils.rb)

It would help to see full set of headers (you can use LiveHTTPHeaders  
or Firebug extesnions for that), but I have a wild idea: can you try  
to rename your swf from  
hello.lzx.swf to, say hello-lzx.swf maybe something along the path  
thinks that  
.lzx is extension of the file, not .swf…

Regards,  
Rimantas

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 21, 2006, 7:41pm UTC](https://www.ruby-forum.com/t/webrick-and-swf-files/80139/3 "2006-12-21T19:41:08Z")

</div>

> It would help to see full set of headers (you can use LiveHTTPHeaders  
> or Firebug extesnions for that), but I have a wild idea: can you try  
> to rename your swf from  
> hello.lzx.swf to, say hello-lzx.swf maybe something along the path thinks that  
> lzx is extension of the file, not .swf…

Renaming the file worked. I also cleared the browser’s cache and the  
original file name works as well.

Thanks for the response.
