mikecao / shorty

A simple URL shortener for PHP
MIT License
272 stars 98 forks source link

Update Max URL Length #2

Closed jaywilliams closed 7 years ago

jaywilliams commented 7 years ago

When dealing with signed Amazon CloudFront URLs, you need to store more than 500 characters.

mikecao commented 7 years ago

Can you bump it to 2000? That seems to be the reasonable max limit according to this http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers

jaywilliams commented 7 years ago

The MySQL varchar field won't typically let you go over 1000, unless you switch to a blob or text type, which you probably don't want.

mikecao commented 7 years ago

The limit is 65535 shared with all the columns in the row, https://dev.mysql.com/doc/refman/5.7/en/char.html. 2000 should be fine.

jaywilliams commented 7 years ago

I tried doing that, but MySQL says: Specified key was too long; max key length is 1000 bytes. I tried dropping the key, and creating a new one, but it didn't make any difference.

mikecao commented 7 years ago

Yea I think indexes can only be a certain length.