Max_url_length is only 500 characters, could that be increased?

(CoinGame) #1

Hey everyone,

Is there a reason the max_url_length is only 500 characters? With the domain character limit of 100 and the URL length of 500 it puts a max of 600 characters for a topic URL. Though up to 2000 characters should be fine.

This limit is breaking a tool that we started using on our forum. If you take a look at the long URL on this topic post you’ll see what I mean. From what I understand it should be okay to increase the max_url_length quite a lot from this current 500 limit. Any thoughts on why this value is chosen for the limit, or if it could be increased? I’d be happy to submit a PR that bumps it up to 1500 or so.

(Jeff Atwood) #2

What tool are you referring to, the one that got broken?

(CoinGame) #3

It’s this github page.

It accepts parameters which are usually much longer than 500 characters. For instance this one from the example above.

Discourse is truncating the URL which breaks the decoding.

(ttutdxh) #4

@codinghorror click on that long link and discourse will redirect your browser to /click/track on the discourse engine to track the link, and then it will issue a redirection to the original link but truncated to 500 chars.

It is because of this, and links should be valid up to around 2048 chars.

(CoinGame) #5

No comment on this at all? I’d really just like to have an explanation to forum users why some things wont work on our forum. If this is not something that will be changed that’s fine. Let me simplify my question question a bit…

Why is the topic URL limited to 500 characters?

(Sam Saffron) #6

I am open to increasing it to 2000, but a far simpler patch is disabling the click tracker for giant urls, its a lot of info to store for very little value.

(CoinGame) #7

Cool. I’ll leave it up to you guys on the best approach. If disableing the tracking on longer URLs works for you it works for me. I know our issue is probably an outlier but your proposed change would be appreciated.

(Jeff Atwood) #8

I also think it’s a generally a bad idea to generate URLs this long @coingame – it’s rather user hostile. Even as you can see in the above reply where the URL was printed, it’s this long string of noise.

(CoinGame) #9

If we’re talking aesthetically sure, it’s ugly. But we know that the big ugly URL could be converted to something nice and cute like this. In some communities (like ours) these long URLs are understandable. I suppose a workaround is to have people posting these types of links with a URL shortener. That really feels like a hack though. Given the solution proposed above I have a better understanding of why the limit exists, but I think this is still a usability pain.

I would appreciate if the app natively ignored tracking on long URLs if it resolves the issue. Discourse offers a means to resolve the aesthetics of long URLs, but as of right now they are functionally broken.

In any direction this issue takes, thank you for the responses. I have a much better understanding of “why” and so it makes it easier to explain to community members of the situation with the URLs they’re sharing.


I have the same problem and I thought, if it is not possible to have a fix, we could have a warning displayed next to big URL links that advises user to right click copy the full link (that workaround even works on mobile).