ProxyPass

Discussion in 'Feedback/Feature Requests' started by dlhhyct, Oct 29, 2006.

  1. dlhhyct

    dlhhyct New Member

    when exploring ajax and XmlHttpRequest(XHR), I realize that browser by default doesn't allow sending XHR to other domains, so one solution is to proxy the site I try to query. so in mysite.com rails app, I like map all request starting with "mysite.com/yahoo" to "api.search.yahoo.com", so XHR call to "/yahoo" transparently gets content from api.search.yahoo.com and update browser UI through js.

    I tried rewriteRules with no luck:
    # has no effect.
    ProxyPass /yahoo http://api.search.yahoo.com/

    # this just redirect browser to yahoo, not what i want.
    RewriteRule /yahoo http://api.search.yahoo.com/

    # caused 500 error, and log ask me to setup external webserver app
    RewriteRule /yahoo http://api.search.yahoo.com/ [P]

    what's the right way to do this?
  2. dlhhyct

    dlhhyct New Member

    clarify

    to make it simple, in my website, i want all my request
    "mysite.com/foo" gets content from "other.website.com/bar", what's the best way to do it?

    for example, i want my site users stay on my site,
    "mysite.com/blog" point to "dlhhyct.blogsot.com",
    so "mysite.com/blog/2006/10/rant" gets content from "dlhhyct.blogsot.com/2006/10/rant",

    proxy external website only allow me to enter ip address, not website address. I want to be able to use website address.
  3. xing

    xing LiteSpeed Staff

    it's not possible to setup a proxy server by entering a domain name or an url.

    LiteSpeed is not designed to be a client proxy which is basically what you are trying to do.
  4. dlhhyct

    dlhhyct New Member

  5. xing

    xing LiteSpeed Staff

    If more of our users use and request this feature, then we will put it on our roadmap.

    This proxy to URL feature is not supported because this type of proxying is not often used and does yet fall under our development mandate of putting in features that at least 70% of our users will find useful.
  6. dlhhyct

    dlhhyct New Member

    ok

    I can hack around this by doing it myself in ruby, but i guess it's much slower than web server doing it.

    as mashup and ajax become more and more popular, instead of just put up some static flickr and google map widgets on own sites. I think down the road more and more user will demand more interactive functionality without leaving the site, that means eventually, demand of cross-domain ajax call will make proxyPass a feature hard to ignore.

    I guess I can wait for now.
  7. xing

    xing LiteSpeed Staff

    Mashups and AJAX are in the general sense API for the backend to interact with other external servers or with web clients. I still don't see how lack of proxy by URL is part of the problem. If your program is ruby, you would query Google/Flickr/etc API and return content back to client.

    If you can explain in detail how you use URL based proxying to enhance your mashup/ajax application, it would greatly help us see the value you have for this feature and how applicable it is to other developers as well.
  8. dlhhyct

    dlhhyct New Member

    ok

    in an ajax call, ajax XmlHttpRequest(XHR) call within own domain ("^/") is allowed, but call to an external website is denied by default browser security setting. One way to work around this is on your own webserver, map "/external" to "external_website.com", so XHR call can get content that way.

    without proxyPass, I can just use ruby's http-access lib to do a wget of remote content, but it's not the best way.

    Here's a conversation when people try to use Google web toolkit (GWT) and facing this problem. http://groups.google.com/group/Goog...6/27a2c4dc34e67802?lnk=gst&q=proxypass&rnum=1
  9. dlhhyct

    dlhhyct New Member

    and another use is just simply proxying,
    "mysite.com/blog" point to "dlhhyct.blogspot.com"
  10. dlhhyct

    dlhhyct New Member

    i think it's a must have

    as I surf more and more. I see there's more use of proxypass.


    such private labeling is getting pervasive. So site owner doesn't have to download and install software to offer additional functionality or revenue stream, like slashdot jobs. and user stays on the site longer.

    The reason I use lsws so I don't have to spend days to figure out apache, nor do I want to setup as additional servers in the middle between my site and external site. please don't let me switch back.

    both apache, lighttpd has it. please implement this.
  11. dlhhyct

    dlhhyct New Member

    if you want ProxyPass, leave a comment

    after you read this, if you find such feature important to you, please reply with "I want it too". thank you.
    -------------------------------------------------------------------------------------------------------

    What is proxyPass?
    It's a feature that allows your website to act as a facade that can get content from other websites. For example, if you have a site called xyz.com, and you want to add forum functionality, and you know coolforums.com offers that, then you open an account on coolforums, and in your site, declare "proxypass forum.xyz.com xyz.coolforums.com", then you got instant forum functionality, doing so hide the supplying site, but this double the bandwidth cost. another way is just to point the DNS address of forum.xyz.com directly to coolforums.com, but revealing the supplying site.

    I'm a site owner, why do I need it?
    It's the simplest way to offer additional functionality on your website, fast. no software to write/install, no hareware to buy, basically you totally outsource it to the utility site which offer the functionality, be it forums, job board, blogs, etc. If you have a high traffic website, then you can offer job board and start earning in matter of minutes this way. Using proxypass allow you to offer more website features in less time, so user will stay on your site longer instead of hopping site to site.

    I'm a web developer, why do I need it?
    Due to default security setting, browser by default doesn't allow sending XmlHttpRequest(XHR) to other domains, most user don't know how to change that or want to change that. so one solution is to proxy the site I try to query. so in mysite.com rails app, I like to map all request starting with "mysite.com/yahoo" to "api.search.yahoo.com", so XHR call to "/yahoo" transparently gets content from api.search.yahoo.com and update browser UI through js.
    for detail post, see http://litespeedtech.com/support/forum/showthread.php?p=3472

    Current status
    lsws does proxy web server already, but only resolves to IP and internal network, not url address. I've asked this before, but not deemed as priority by the development team.

    As I surf more and more, I find Proxypass is empowering a whole new generation of websites, which offer internet services meant to be private labeled, or used as utility, whatever you call it. instead of creating the next blogspot.com, typepad allow user's blog to be integrated into user's own site. Instead of creating next monster.com, jobthread.com allow highprofile sites (slashdot, salon) to customize and integrate it onto their own site. Proxypass is doing all that magic behind the scene.


    references
    apache doc: http://httpd.apache.org/docs/1.3/mod/mod_proxy.html#proxypass

    examples
    Last edited: Nov 12, 2006
  12. mistwang

    mistwang LiteSpeed Staff

    The two examples you give does not implemented with proxypass, they are just domain alias for the same vhost, the two domain names point to the same server.
  13. rlance

    rlance New Member

    needed for Zope

    ProxyPass would indeed be helpful for Zope based sites using VirtualHostMonster.

    Typically I run zope instances run on ports 8080 - 8100. The apache mapping of one such goes like:
    ProxyPass / http://site.name:8082/VirtualHostBase/http/site.name:80/site/VirtualHostRoot/
    ProxyPassReverse / http://site.name:8082/VirtualHostBase/http/site.name:80/site/VirtualHostRoot/

    So, besides the current external Web Server 127.0.0.1:8082, it would be nice to allow the /VirtualHostBase/http/site.name:80/site/VirtualHostRoot/ as an additional part of the mapping of the site root.
  14. dlhhyct

    dlhhyct New Member

    hmm..

    yes, you are right.

    but if i really want to hide the supplying site, i can do it using proxypass. at the cost of doubling the bandwidth. I don't know if anyone does that now.

    plus, it's a standard feature on apache and lighttpd, i don't understand why can't lsws have it.
    Last edited: Nov 12, 2006
  15. dlhhyct

    dlhhyct New Member

    more

    * http://blog.guykawasaki.com/ points to --- http://guykawasaki.typepad.com/blog/ ,

    I thought about it again. Yes, i was wrong, i guess people dont do ProxyPass cross servers, since it's just not so efficient, unless they really want to. But I think they still do it locally.

    here's how I will implement this: blog app is a virtual host taking wildcard domains, and looks for subdomain to serve the user. to accomodate outside domain names, add Proxypass that connect outside domain to matching subdomain, I think that's the simplest way.

    Is there way to translate outside domain to matching subdomain without using Proxypass?
    what's the right way to do it in lsws? is it possible to be done programmtically without manual input?

    I'm asking for this because that's the direction I'm going, so this feature is really important to me. and I think that's direction the internet is going, more utility like.
  16. mistwang

    mistwang LiteSpeed Staff

    I think the example you given is just implemented with URL rewrite, no Proxypass involved at all.
  17. mistwang

    mistwang LiteSpeed Staff

    rlance,

    you can use URL rewrite with Zope + FCGI for the same purpose.
  18. dlhhyct

    dlhhyct New Member

    if u read the beginning of the thread, i tried rewrite without success. can you show me how?

    what does proxypass do extra, that rewrite can't do? There must be a reason both apache and lighttpd have mod_proxy.
  19. dlhhyct

    dlhhyct New Member

    not working for me

    as far as i know. url rewrite will redirect first link to second link, not proxying.

    if anyone can use rewrite to do what proxypass can do, let me know.
  20. xing

    xing LiteSpeed Staff

    dlhhyct,

    rlance's situation is that both vhost is on the same server. Why do you want to proxy when rewrite is more efficient? Your situation might be different as you are proxying out to 3rd party networks but when services on the same server, just different paths, proxypass is not the best answer.

Share This Page