How do i bypass the URL limit

This might not be 100% roblox related, but i kept surfing and surfing at the internet and i found little to no solutions to this problem, Basically, i want to pass some generated dts code to my local express server so i can fetch it and do stuff with it. but i found a horrible limitation, these urls cant go over that 80 kb limit (uri i think) and my dts code generator would go over that limitation very well. So, here is my code

                success, result = pcall(httpService.RequestAsync, httpService, {
                    Url = string.format("http://localhost:%s/dts/", state.portText)..urlEscape(generateDtsCode(refToObject)).."/",
                    Method = "POST",
                    Headers = {
                        ["Content-Type"] = "application/x-www-form-urlencoded"
                    }
                })

If i had to move the Url parameter to headers or body etc etc I would be more than happy to do so as long as it fixes the issue.
Thanks

1 Like

80kB is 80k characters, if you’re sending request anywhere with URI size bigger than 80k, then you’re doing really bad practice.
Rather put such content into POST body.

PS: don’t forget to run your express server on some more accessible machine since Roblox servers won’t be able to reach your localhost.

2 Likes

You got 80KB on it? That’s really good because I think the official spec from the WWW consortium is 2048 bytes. If you need to send more data, use either a POST operation (I think the limit is 4 or 8 MB), or a PUT operation (unlimited). I had to write PHP code to deal with a PUT on my web application some time ago.

1 Like

Wait Put exists? let me try it, thank you for saying what this is but do you know how to do it in express?

I tried doing bodies but they somehow never worked. express never fetched it, well and the object im converting is a dummy humanoid and i want it to be unlimited

I prefer localhost because 1. its what rojo did so it should be fine 2. I dont wanna get charged for data, since this is gonna be a resource soon

thanks

Umm… No. I have never heard of Express before. When I do web development, I use the LAMP stack. I know some others use the MEAN stack. Web servers natively support GET and POST operations and PHP supports it too. However, with PUT, you are on your own. The data is base64 encoded, and there’s information in the stream you have to look for that’s defined in the header. I developed a explorer like GUI so I could see and manipulate the filesystem on the web server. File uploads were handled by PUT, not POST.

Basically, you get the separator prefix from the header. When you get the PUT request, you save the stream to a temp file. Once the stream completes, you access the file and look for the separator (I believe it’s actually a prefix). From that, you break the temp file into multiple files (There’s filenames defined between the file data segments.). It’s fairly involved. There’s code out there to do it, but unless you absolutely need it, I would just use POST instead.

Alr, Im using a post request, and whenever i try to move it to the body this express thing never works (i will leave a link to express here so you can know how it works) and express never fetches it,when i move it to the url parameter it somehow works again? I will send the code for express later but its really really simple

Well, here’s my file upload code using PUT in PHP. There’s extra stuff in there relating to error handling and security, but the gist is there. This is a METHOD which is part of a PHP CLASS.

-- Code Removed

Since this is not LUA code, the syntax highlighting is screwed up. I don’t know anything about Express and I haven’t really messed with Node.js, so you’re on your own with that. Others here may be more knowlegable in it than I am.

Since this is a web development question, have you tried asking on https://stackoverflow.com/?

Unrelated tip:

just do
```<LANGNAME>
```.

ill try later but for now ill try body again

Good news: switching to BODY worked but it was hell to switch to it

well atleast it works, thanks