Thanks Michael and Geert ! :)
On Tue, Sep 27, 2011 at 21:16, Geert Josten <[email protected]> wrote: > Why not make that: > > let $proxyuri := resolve-uri( > substring-after($uri, $host), $proxy) > > :) > > Kind regards, > Geert > > -----Oorspronkelijk bericht----- > Van: [email protected] > [mailto:[email protected]] Namens Michael Blakeley > Verzonden: dinsdag 27 september 2011 21:13 > Aan: General MarkLogic Developer Discussion > Onderwerp: Re: [MarkLogic Dev General] Will http-get support proxies in ML > 5.0 ? > > Glad to hear it. But won't that proxyuri expression always get the last path > token? What if the path is something like a/b/c? If so, I'd try this: > > let $proxyuri := concat( > $proxy, substring-after($uri, $host)) > > -- Mike > > On 27 Sep 2011, at 11:55 , Jakob Fix wrote: > >> To finish(?) this thread on a positive note ... I've finally managed >> to beat our proxy from MarkLogic. Actually, using the "?" in between >> proxy and remote URL doesn't always work. What seems to always work >> however in our case, is to not use the question mark, but to only add >> the remote URL's path component, and to always set the Host HTTP >> header. Example for archival purposes below. >> >> let $proxy := "http://my.proxy.org:80" as xs:string; (: simple http proxy :) >> let $uri := "http://api.scribd.com/api" as xs:string; (: target web service >> :) >> >> let $host := tokenize($uri,'/')[3] (: ==> api.scribd.com:) >> let $proxyuri := concat($proxy, '/', tokenize($uri, '/')[last()]) (: >> ==> http://my.proxy.org:80/api :) >> >> (: ... :) >> >> return >> xdmp:http-post( >> $proxyuri, >> <options xmlns="xdmp:http"> >> <headers> >> <Host>{$host}</Host> >> <Content-Type>multipart/form-data; >> boundary={$boundary}</Content-Type> >> </headers> >> </options>, >> $patched-multipart-encode >> ) >> >> >> cheers, >> Jakob. >> >> >> >> On Mon, Sep 26, 2011 at 16:23, Jakob Fix <[email protected]> wrote: >>> Oops, Geert was right, adding "?" between proxy and target url works. >>> >>> Now I only have to make http-post work, too! >>> >>> cheers, >>> Jakob. >>> >>> >>> >>> On Mon, Sep 26, 2011 at 16:16, Jakob Fix <[email protected]> wrote: >>>> I'd love if this worked for us, but it doesn't. We have a "websense >>>> proxy"[1]. The following is the output from Jim's query, please note >>>> the document returned corresponds to Google's 404 (which is quite >>>> geeky "!!1", horribly invalid, but oh so very much optimized) because >>>> somehow the proxy sends as the requested URL >>>> 'http://www.google.com/www.google.com/' which doesn't exist, >>>> apparently ... >>>> >>>> <response xmlns="xdmp:http"> >>>> <code>404</code> >>>> <message>Not Found</message> >>>> <headers> >>>> <content-type>text/html; charset=UTF-8</content-type> >>>> <x-content-type-options>nosniff</x-content-type-options> >>>> <date>Mon, 26 Sep 2011 14:02:19 GMT</date> >>>> <server>sffe</server> >>>> <x-xss-protection>1; mode=block</x-xss-protection> >>>> <x-cache>MISS from www-proxy.atmyorganisation.org</x-cache> >>>> <via>1.0 net-gw2.atmyorganisation.org:3128 (squid/2.7.STABLE7)</via> >>>> <content-length>11803</content-length> >>>> <age>0</age> >>>> </headers> >>>> </response> >>>> <!DOCTYPE html> >>>> <html lang=en> >>>> <meta charset=utf-8> >>>> <title>Error 404 (Not Found)!!1</title> >>>> <style> >>>> *{margin:0;padding:0}html,code{font:15px/22px >>>> arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{background:url(data:image/png;base64,iVBORw0KGgoAAA >>>> [more base64 data cut]) 100% 5px no-repeat;margin:7% auto >>>> 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > >>>> body{padding-right:205px}p{margin:22px 0 >>>> 0;overflow:hidden}ins,#g{text-decoration:none}ins{color:#777}a >>>> img{border:0}#g{background:url(data:image/png;base64,iVBORw0KGgoAAA[more >>>> base64 data cut]);display:block;height:55px;margin:0 0 >>>> -7px;width:150px}* > #g{margin-left:-2px}#g img{visibility:hidden}* >>>> html #g img{visibility:visible}*+html #g img{visibility:visible} >>>> </style> >>>> <a href=//www.google.com/ id=g><img >>>> src=//www.google.com/images/logo_sm.gif alt=Google></a> >>>> <p><b>404.</b> <ins>That's an error.</ins> >>>> <p>The requested URL <code>/www.google.com/</code> was not found on >>>> this server. <ins>That's all we know.</ins> >>>> >>>> >>>> so it looks like our proxy is mishandling the request url. Btw, just >>>> trying to use the url without the protocol (http://) doesn't work >>>> either. Any more ideas welcome, of course. >>>> >>>> cheers, >>>> Jakob. >>>> >>>> [1] http://en.wikipedia.org/wiki/Websense >>>> >>>> >>>> >>>> On Thu, Sep 22, 2011 at 13:14, James Fuller <[email protected]> >>>> wrote: >>>>> in the meantime you can do something like this; >>>>> >>>>> declare function local:http-get-proxy($proxy, $uri){ >>>>> let $host := fn:tokenize($uri,'/')[3] >>>>> let $proxyuri := fn:concat($proxy,$uri) >>>>> return >>>>> xdmp:http-get($proxyuri, >>>>> <options xmlns="xdmp:http"> <headers> <Host>{$host}</Host> >>>>> </headers></options> >>>>> ) >>>>> }; >>>>> >>>>> local:http-get-proxy('http://some.proxy.com:8080','http://www.google.com') >>>>> >>>>> works with all proxy setups I tested. >>>>> >>>>> gl, Jim Fuller >>>>> >>>>> On Thu, Sep 22, 2011 at 10:43 AM, Geert Josten <[email protected]> >>>>> wrote: >>>>>> I wouldn't mind it being a general configuration option at host level >>>>>> either, by the way. That should work for most cases I guess.. >>>>>> >>>>>> Kind regards, >>>>>> Geert >>>>>> >>>>>> -----Oorspronkelijk bericht----- >>>>>> Van: [email protected] >>>>>> [mailto:[email protected]] Namens Jakob Fix >>>>>> Verzonden: donderdag 22 september 2011 10:32 >>>>>> Aan: General MarkLogic Developer Discussion >>>>>> Onderwerp: Re: [MarkLogic Dev General] Will http-get support proxies in >>>>>> ML 5.0 ? >>>>>> >>>>>> Hear hear! +1 >>>>>> >>>>>> I had discussion with product management people at mluc this year >>>>>> where I requested this feature, but haven't had any news since, so am >>>>>> definitely interested also! >>>>>> >>>>>> Jakob. >>>>>> >>>>>> >>>>>> >>>>>> On Thu, Sep 22, 2011 at 09:34, Geert Josten <[email protected]> >>>>>> wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I am once more plagued by running MarkLogic Server behind a proxy and >>>>>>> trying to use xdmp:http-get and related functions. Will MarkLogic >>>>>>> Server 5.0 support proxy options (server, port, user, pass)? >>>>>>> >>>>>>> Kind regards, >>>>>>> Geert >>>>>>> >>>>>>> _______________________________________________ >>>>>>> General mailing list >>>>>>> [email protected] >>>>>>> http://developer.marklogic.com/mailman/listinfo/general >>>>>>> >>>>>> _______________________________________________ >>>>>> General mailing list >>>>>> [email protected] >>>>>> http://developer.marklogic.com/mailman/listinfo/general >>>>>> _______________________________________________ >>>>>> General mailing list >>>>>> [email protected] >>>>>> http://developer.marklogic.com/mailman/listinfo/general >>>>>> >>>>> _______________________________________________ >>>>> General mailing list >>>>> [email protected] >>>>> http://developer.marklogic.com/mailman/listinfo/general >>>>> >>>> >>> >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general >> > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
