Forum Moderators: phranque

Message Too Old, No Replies

Proxy request is not working

         

kiranpeter

10:01 am on Aug 31, 2009 (gmt 0)

10+ Year Member



Hi

I have developed a chat functionality in my site with jwchat as client and ejabberd as chat server. I have setup chat server in different IP and and site in other server. In chat, how it work is, when a request has come it redirect to chat server using .htaccess.

In .htaccess i have given as follows

AddDefaultCharset UTF-8
Options +MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule http-bind/*. [000.000.0.000:5280...] [P]

</IfModule> But it is not redirecting to chat server. I have already setup mod_proxy and mod_balancer modules in Apche.

Anyone pls help me.

[edited by: engine at 11:08 am (utc) on Aug. 31, 2009]
[edit reason] IP obfuscated [/edit]

jdMorgan

12:10 pm on Aug 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try
 Options +FollowSymLinks -MultiViews 

instead.
And change the rule to

RewriteRule ^http-bind/(.*)$ http://192.168.0.3:5280/http-bind/$1 [P]

Do not enable MultiViews unless your site requires content-negotiation to function.

Jim

kiranpeter

12:30 pm on Aug 31, 2009 (gmt 0)

10+ Year Member



Hi Jim,

I tried as you told. But it is not working.

RewriteRule ^http-bind/(.*)$ [192.168.0.3:5280...] [P]

Thanks

jdMorgan

5:12 pm on Aug 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As long as all requested 'chat' URL-paths start with "/http-bind" or are rewritten to start with "/http-bind", then that code should work.

Jim

kiranpeter

3:31 am on Sep 1, 2009 (gmt 0)

10+ Year Member



Sorry Jim for late response,I have to go out urgentily

It is working in my local machine with above configuration.

RewriteRule http-bind/*. [000.000.0.000:5280...] [P]

But it not working in live site. It shows service is unavailable.

Fact is that if I remove [P] from RewriteRule it will redirect to chat server.I have added
mod_proxy mod_proxy_balancer mod_proxy_ftp mod_proxy_http mod_proxy_connect in apache configuration.

jdMorgan

2:00 pm on Sep 1, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The rule you posted above contains an incorrect pattern. Try the one I posted, which is correct.

"bind/*." means, "match 'bind' followed by any number of slashes (including zero) followed by at least one of any single character. It creates no back-reference, so "$1" as used in the substitution URL will be blank, and all requests for all chat page URLs will therefore be proxied to the root page on the chat server.

Jim

[edited by: jdMorgan at 12:13 pm (utc) on Sep. 2, 2009]

Caterham

9:44 am on Sep 2, 2009 (gmt 0)

10+ Year Member



I have added
mod_proxy mod_proxy_balancer mod_proxy_ftp mod_proxy_http mod_proxy_connect in apache configuration.

And why don't you use a normal ProxyPass directive in your httpd.conf in that case but brother with mod_rewrite in per-dir context; even .htaccess files?