在glassfish中从docroot重定向到外部网址 [英] Redirect from docroot to an external url in glassfish

查看:100
本文介绍了在glassfish中从docroot重定向到外部网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了一下,只找到了解决方法,他们建议在a glassfish前放置一个apache httpd。当然,这是有效的。



但是如果我不希望/不能在glassfish面前摆放任何东西?



 <%
String redirectURL =https://stackoverflow.com/;
response.sendRedirect(redirectURL);
%>

当我将它指向以下位置时,是否可以让浏览器重定向: http://my.glassfish.domain/



提供一点点更多详细信息:

我尝试将以下属性添加到虚拟服务器:
redirect_1 from = / url = https://stackoverflow.com/
但是,这使得一切都被重定向到 https://stackoverflow.com / ,例如。 http://my.glassfish.domain/myapp 重定向到https://stackoverflow.com/ ,而我只想要 http:// my.glassfish.domain / 被重定向到 https://stackoverflow.com/



有什么帮助吗?

解决方案

也许你可以使用 UrlRweriteFilter 根据定义的映射重定向用户。 这里是一些例子


I've googled around and only found solution where they suggest putting an apache httpd in front of glassfish. Sure, that works.

But what if I do not wish to/cannot put any thing in front of glassfish?

Without using the index.jsp in the docroot of the domain to have something like:

<%
    String redirectURL = "https://stackoverflow.com/";
    response.sendRedirect(redirectURL);
%>

Can I make browser to be redirected when I point it to: http://my.glassfish.domain/ ?

To provide a little bit more details:

I tried adding a property to the vitual server as: redirect_1 from=/ url=https://stackoverflow.com/ But that make everything to be redirected to https://stackoverflow.com/, eg. http://my.glassfish.domain/myapp redirects to https://stackoverflow.com/ while all I want was http://my.glassfish.domain/ to be redirected to https://stackoverflow.com/

Any help please?

解决方案

Maybe you can use UrlRweriteFilter to redirect users according to defined mappings. Here are some examples

这篇关于在glassfish中从docroot重定向到外部网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆