Home Apache rewrite rule to proxy
Reply: 0

Apache rewrite rule to proxy

Claus Bo
1#
Claus Bo Published in 2018-01-10 22:58:59Z

I need apache to rewrite and proxy (both http and ws)

http://example.com/dir1/dir2/1234/argument 

to

http://localhost:1234/dir2. 

I have tried these rewrite rules (at .htaccess in dir1):

RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule ^([^\/]*)\/(\d*)\/(.*)$  http://localhost:$2/$1/$3 [P,L]

RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule ^([^\/]*)\/(\d*)\/(.*)$  ws://localhost:$2/$1/$3 [P,L]

But getting an internal error (500) from apache.

Any suggestions?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.299945 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO