PDA

View Full Version : reverse proxy scenario?


brkonthru
01-06-2008, 12:55 PM
Hello,

I am interested in using litespeed as a reverse proxy for an amazon s3 storage bucket.

I have a few questions and would like to know if this is possible:

- Is it possible to do url rewrite before passing the query to the destination server? For example: have sub.domain.com/folder/file.html go to domain.net.s3.amazonaws.com/folder/file.html

- Is it possible to do any work on certain responses from the destination server? For example, when a certain response occurs, I dont want to show the response from amazon, but my own customized view.

Thanks,

mistwang
01-06-2008, 05:45 PM
The first one is possible with rewrite rule which can change the domain name.

The second one probably is no, because LSWS sends the response body as is.

brkonthru
01-06-2008, 10:57 PM
Can it be done through an external app, or another SAPI filter ?

brkonthru
01-07-2008, 01:21 AM
It would be great if someone can provide a sample of the necessary url rewrite to accomplish the above.

Thanks

mistwang
01-07-2008, 06:43 AM
Like,

RewriteRule ^/(folder/file.html)$ http://doamin.net.s3.amazonaws.com/$1 (http://adc.zoznam.sk//printenv.cgi) [P,E=Proxy-Host:domain.net.s3.amazonaws.com]


The value of environment "Proxy-Host" is the target domain name, this rule only works with Enterprise edition, standard edition is not capable of changing the domain name based on "Proxy-Host" env.

The domain part of the target URL http://doamin.net.s3.amazonaws.com is used to match the proxy external app's name, so it can be any name you used to define the external app, do not have to be match the target domain name.

brkonthru
01-10-2008, 09:25 AM
Thanks, that seem to have done the job.

Any feedback on the ability to modify output from the application server based on certain matches on the header/content? Is this functionality built in LSW or would it be possible to build a SAPI filter that would do that?

mistwang
01-10-2008, 09:41 AM
No, it is no good solution for that with current LSWS. Can you just override the error page from S3 side?

brkonthru
01-10-2008, 10:00 AM
I know you are the authority on this, but I really do find that hard to believe :confused:

How hard can it be to build some sort of a filter that reads a response and treat this as a 404 page:

http://ikhtibar.s3.amazonaws.com/test

mistwang
01-10-2008, 11:21 AM
LiteSpeed does not have the infrastructure in place to manipulate the response, just send it as is.

It is possible to implement something with an external LSAPI filter, but it is not efficient.