[MarkLogic Dev General] 302 redirect response

semerau at hotmail.com semerau at hotmail.com
Tue Nov 30 14:25:53 PST 2010


Stewart, this has worked for us. Called from a rewriter:

declare function local:redirect-from-old-url($new-url) {
    ("/", xdmp:redirect-response($new-url), xdmp:set-response-code(302, "Found"), xdmp:add-response-header("Location", $new-url))
};

From: nunojobpinto at gmail.com
Date: Tue, 30 Nov 2010 21:56:55 +0000
To: general at developer.marklogic.com
Subject: Re: [MarkLogic Dev General] 302 redirect response

Hi Stewart,
I don't have a MarkLogic Server here handy but have you tried this in the browser or in a tool like curl? It might be that you are following the response and consequently getting a 200?


I remember doing some testing on this in MarkLogic API [https://github.com/dscape/MarkLogicAPI/blob/master/test/remove-later.sh] and from what I recall it did return 301 with appropriate headers. Then again it was some months ago.


Nuno

On Tue, Nov 30, 2010 at 9:09 PM, Stewart Shelline <ShellineSE at ldschurch.org> wrote:


Yeah, I tried that. Unfortunately, the following returns 200/OK instead of a 302:

 let $new-page := "redirectee.xqy"return

    (xdmp:set-response-code( 302, "Moved permanently" ),    xdmp:redirect-response( $new-page ))

   

From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Nuno Job


Sent: Tuesday, November 30, 2010 2:07 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] 302 redirect response

 Try xdmp:set-response-code() http://developer.marklogic.com/pubs/3.2/apidocs/AppServerBuiltins.html#set-response-code

 NunoOn Tue, Nov 30, 2010 at 8:56 PM, Stewart Shelline <ShellineSE at ldschurch.org> wrote:

Is there any way to use xdmp:redirect-response() to send a response code of 302? Or is there a better way to do this? 



NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

 
_______________________________________________
General mailing list
General at developer.marklogic.com


http://developer.marklogic.com/mailman/listinfo/general 
_______________________________________________



General mailing list

General at developer.marklogic.com

http://developer.marklogic.com/mailman/listinfo/general





_______________________________________________
General mailing list
General at developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20101130/b6ff6e11/attachment.html 


More information about the General mailing list