Knowledgebase

Portal Home > Knowledgebase > Articles Database > Apache Reverse Proxy and Rewrite


Apache Reverse Proxy and Rewrite




Posted by stuartornum, 07-02-2010, 09:15 AM
Hi, This is probably a quick fix for someone that has done this before, so here goes.. I have an Apache reverse proxy sitting on top of some app servers. One of the app servers is for the API. Ideally we want users to access the API via domain.com/api/request/goes/here. However, I want to rewrite the URL to domain.com/request/goes/here (omitting the /api/) and then do the reverse proxy which follows. Any suggestions would be most welcome. Thanks

Posted by Aigen_tech, 07-02-2010, 09:24 AM
domain.com/request/goes/here will point to the document root for the domain.com. If you want to go the folder /api then you will haev to use /api in the url or else you can setup the /api as a subdomain http://api.domain.com

Posted by stuartornum, 07-02-2010, 09:36 AM
Hi, Thanks for the quick response! Sorry, I probably didn't make myself clear. The box api.domain.com is only accessible through the reverse proxy. Not directly from the internet. Therefore requests coming in will look like this: domain.com/api/request/goes/here - To the RProxy and this is the bit im struggling with... the URL needs to be rewritten to: api.domain.com/request/goes/here - Still on the RProxy and then the reverse proxy needs to push it to: api.domain.com:8080/request/goes/here - The app server Thanks again.

Posted by Aigen_tech, 07-02-2010, 09:57 AM
Hi, You can use .htaccess redirection to aceihve that. Create a .htaccess file with the following content and then in jk.conf change the code to I think that should work. Please check and let me know if that works.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
big server load (Views: 608)
rkhunter warnings (Views: 557)
Fasthosts & Linux (Views: 528)


Language:

Contact us