2008/4/12, Malcolm Gorman <[EMAIL PROTECTED]>:
> During development I want to serve static JSON files to my AJAX
>  application. Serving
>  it from an Apache web server on the same server URL but different port
>  number (different
>  from my Tomcat port number) gives me a same origin policy error in
>  Firefox (though not IE). To get around this quickly, I thought I'd
>  serve static content from Tomcat itself, using
>  the same port. But how?
>
>  I've Googled on this and read the Tomcat FAQs and even JBoss FAQs on serving
>  static content from Tomcat. All of them say it's slow and you wouldn't
>  want to do it,
>  and to proxy to your Apache web server instead. I don't want to do
>  that, for various
>  reasons, but if I have to, I will.

They're right, you know...

You can do something like this:

* configure a Coyote HTTP connector (but I guess you've done that already),
* in your Apache conf file:

NameVirtualHost x.y.z.t:80

<VirtualHost your.server.name:80>
        ServerName your.server.name
        #
        # DO NOT FORGET THE TRAILING SLASHES!
        #
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/
</VirutalHost>

This way, Tomcat will serve everything AND your 8080 port will not
even show in the URL. Heck, your Tomcat/JBoss can even be on a
different machine (just change localhost).

-- 
Francis Galiegue, [EMAIL PROTECTED]
"When it comes to performance, weight is everything" - Tiff Needell

---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to