开发者

Fallback action in case of 404 in Tomcat

I have two severs New and Old. Both serve static content (and dynamic content but this is out of scope of this question).

I'd like to expose static content from Old server in New server using a reverse proxy. The content on the new server should take precedence. I've already developed a custom reverse proxy but I would like to avoid developing custo开发者_高级运维m servlet to serve static content.

Do you see any clean way to relay requests to Old server in case that new server can't handle it?

I know that I can provide my custom error page and do the magic there but this is not a clean solution.

I use Tomcat 6, UrlRewriteFilter, proprietary web framework.


I'd suggest defining your own default servlet mapping in web.xml as covered here, then checking to see if the requested file exists and if it does forwarding the requested file to the default servlet as outlined here. If it doesn't exist then send it to your reverse proxy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜