Written by

Senior Cloud Architect at InterSystems
MOD
Question Eduard Lebedyuk · May 9, 2018

Redirect longer than 3972 characters is truncated

I need to redirect user to a url, which is 5000+ characters long.
To do that I set:

set %response.Redirect = url

However, in the browser I receive this header:

LOCATION: <First 3972 characters of the 'url' variable>

In WriteHTTPHeader method of %CSP.Response, where the LOCATION header is
written:

Write "Location: ", <Redirect>,!

After I added a buffer flush, after the above-mentioned line:

Write *-3

Then in browser I received full, correct value of a LOCATION header.
Is there a better solution?
It's a rest API, so maybe there's some callback method I can override to flush the output buffer? Set device mode? Change buffer size?

Comments

Eduard Lebedyuk  May 9, 2018 to Sean Connelly

ServerSideRedirect  doesn't work in that context (OAuth authentication) unfortunately.

I also tried setting LOCATION header directly (via SetHeader method) - in that case I get the same truncated output.

0
Robert Cemper · May 9, 2018

Eduard,

I googled around "max url lenght"  and found
#1 browser depending
#2 limit yourself to 2048 char.
So is your redirect just URL or  URL?urlparams=...... 

0
Eduard Lebedyuk  May 9, 2018 to Robert Cemper

#2 limit yourself to 2048 char.

Nowadays it's fine. Most browsers work with long URLs.

So is your redirect just URL or  URL?urplarams=...... 

It's  URL?urplarams=...... 

One parameter is 5000+ symbols long.

0
Robert Cemper  May 9, 2018 to Eduard Lebedyuk

is it persistent across different browsers ?

IF YES -> our problem,
OR do you see different cut off lengths.
 I especially distrust IE !
 

0
Eduard Lebedyuk  May 9, 2018 to Robert Cemper

It's on Cache side as adding

Write *-3

fixes the problem.

0
Robert Cemper  May 9, 2018 to Eduard Lebedyuk

Congratulations!

docs say:

  Sends any buffered output out the TCP connection; that is, executes a TCP SEND operation on the data in the output buffer.
If the data is compressed (/GZIP) stream data, *-3 sends the data without marking the compression endpoint.

I interpret this: 
up to some limit, it is sent somehow automatically
and the eventual rest needs to be pushed out manually or gets never sent or is to late.

???  surprise

0
Eduard Lebedyuk  May 10, 2018 to Robert Cemper

The problem with write *-3 is that it is currently added to a system code. I'm searching for a better solution.

0