0

As mentioned in this thread an URL has a length restriction. But what do I do when I have to submit an array of values via get parameters and can't ensure that the url doesn't exceed max length?

I know I could POST the request, but I want users to be able to bookmark/ cache the link.

F.M.F.
  • 1,929
  • 3
  • 23
  • 42
  • Using a different data format might also help ... like f.e. JSON for simple arrays could reduce the length by a lot, I suppose ... – CBroe Nov 16 '17 at 14:38
  • @CBroe you mean passing an JSON string as get-paramater? – F.M.F. Nov 16 '17 at 14:39
  • 2
    Yes. You’ll have to decode it accordingly on the receiving end of course. But `foo[0]=bar&foo[1]=baz&foo[2]=blubb` vs `foo=["bar","baz","blubb"]` could make a difference, especially if `foo` was actually an even longer parameter name, and there are more values than the three in this example ... – CBroe Nov 16 '17 at 14:42

1 Answers1

3

The only possible solution would be to reduce the length of the URL as much as you can.

And if you can't reduce the amount of information that you need to transmit, try reducing the length of your GET parameters

Fabian Bettag
  • 799
  • 12
  • 22