Apache modproxy & redirect problem & solution

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Apache modproxy & redirect problem & solution

Artem Melentyev
Hi all.

I am using apache modproxy to connect main apache server to internal
tomcat server. (usunet.ru/xwiki)
and find this problem:

On save document, xwiki call redirect by Full URL of Internal
server(yh:8080) and got error 404 becouse internal host is inaccessible

I fix this problem for by writing in
com.xpn.xwiki.web.XWikiServletURLFactory:

{code}
private URL getServerURL(String xwikidb, XWikiContext context) throws
MalformedURLException {
   final String host = context.getRequest().getHeader("x-forwarded-host");
   if (host!=null && !host.equals(""))
     return new URL("http://"+host);
   ...
{code}

(Apache modproxy adds header "x-forwarded-host" = apache host)

Maybe better to redirect by uri without server name?

--
Artem Melentev, UralSU, CS301. http://usunet.ru/xwiki/
        jabber: [hidden email] | icq: 175349029



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Apache modproxy & redirect problem & solution

Ludovic Dubost

Interesting.. you can commit this..
I'll check why the redirect is by full URL and if it can be by URI

Ludovic

Artem Melentev wrote:

> Hi all.
>
> I am using apache modproxy to connect main apache server to internal
> tomcat server. (usunet.ru/xwiki)
> and find this problem:
>
> On save document, xwiki call redirect by Full URL of Internal
> server(yh:8080) and got error 404 becouse internal host is inaccessible
>
> I fix this problem for by writing in
> com.xpn.xwiki.web.XWikiServletURLFactory:
>
> {code}
> private URL getServerURL(String xwikidb, XWikiContext context) throws
> MalformedURLException {
>   final String host = context.getRequest().getHeader("x-forwarded-host");
>   if (host!=null && !host.equals(""))
>     return new URL("http://"+host);
>   ...
> {code}
>
> (Apache modproxy adds header "x-forwarded-host" = apache host)
>
> Maybe better to redirect by uri without server name?
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  

--
Ludovic Dubost
XPertNet: http://www.xpertnet.fr/
Blog: http://www.ludovic.org/blog/
XWiki: http://www.xwiki.com
Skype: ldubost AIM: nvludo Yahoo: ludovic




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws