TinyWebDB requests generate HTTP 406

Sigh. Autocorrect plays tricks on me. Including not correcting the obvious…

And I did put the same explicit setting of service URL in front of the get and store of the tinyDB blocks tio, but realize now they are not there in my picture. Sorry fornthe confusion I had removed them there asically because they so obviously do not work, because they give the URLs with “getvalue.php/getvalue” that were commented as strange.

I said in the original post that I tried that as a solution, absolut. It was what I found in other threads, so ibhad tried it long before postning myself.

Only because you (or someone) told me to try with these. Earlier in the thread you see the Tiny WebDB block that I started with. When i was adviced to tty with Web blocks, I did, and posted the picture of those to.

To summarize:

  • Tiny WebDB blocks i cannot get to work no matter what. Always HTTP 406 regardless of what database version i use.
  • Web Blocks work perfectly fine, towards the same two Tiny WebDB installations i had from the very start, as well as the ones you provided

I think it is reasonably safe to say the DB itself (all there variants) works. Which leaves me wondering if the Tiny WebDB blocks are not at all doing what I think. Or if it sends something my webbserver dislikes, and rejectd before letting my php-code even try doing something.

It works fine on AppInventor 2.

Perhaps there is an issue with the kodular tinywebdb code, although I understand they work in the same way. (something has changed, because it used to work fine on Kodular, @Diego wrote the original guide…)

or something else…

Worth a try:

twbtest.aia (2.0 KB)

this is built on AI2 so may complain when you load. Uses my server. Does this work ?

No, it crashes Kodular when trying to build, and when trying to switch from designer to blocks.

In addition, it is pretty much identical to what i had before starting this thread, apart from not using your DB.

I think I found a solution, even though it is not the right one. My hosting provider had some info saying it returns 406 for some requests that apperas malicious, and said Icoud turn this iff by adding this to the .htaccess file

<IfModule security2_module>
    SecRuleRemoveByTag unoeuro
</IfModule>

(this may be very specific to the provider, I do not know)

I tried, and it all suddenly works. The root of the issue is still partly with how Kodular formats the request, though, and while this is a working workaround, it feels unsafe and wrong to turn off security things.

One of the variants i tried prior to posting here:
image

Resulting log entries when i run that again now:

I do not see any significant difference compared to your aia-file.

I tried my Kodular code with your database URL, with no explicit giving of the servcie URL before each call, and I get the same http 406

However, giving the explicit service URL before each call (which can hardly be what you are supposed to have to do?), it works!

This makes me think i have isolated the fault to my PHP environment. My PHP-code works, and so does yours. But when called from Kodular blocks, neither of them works on my host, but your code does on your host. I am convinced that my PHP code would work just fine on your host.

I am not sure if it is worthwhile going through all the hassle of figuring out what is (probably) wrong with my cheap webhost and its PHP setup. I can make this work with WebBlocks, and go on doing something more interesting. It woudl however be really interesting to see what Kodular does with its Tiny WebDB block requests that it does not do with its WebBlock requests

Thanks for all the help and your patience!

I realize my posts are approved in a different order than they are posted, meaning they are confusing to read, since (at least to me) they show up in the wron gorder.

Of course I found the solution/workaround after I posted about my conclusion that there is something with my hosting provider or PHP environment. No matter what order these messages appear in the thread.

Thanks again for all the help. I will likely use the Webblock approach instead (it fulfills my needs), since I do not feel comfortable with the workaround to disable security related features, even though I do not know what it actually does, or what the risk is.

This has obviously been very frustrating for you to get to a reason/solution, but I am pleased to hear that testing the tinywebdb blocks to a different server has shown that the issue lies with your server, and not with Kodular or the tinywebdb blocks. (I have now disabled my server path)

For the simple php files I provided, that were based upon @Diego’s original guide, there is nothing wrong with providing the full path to the php files in the service url, they cannot find the php file otherwise. Different php/composite files will be able to receive just on the url to the site.

I believe you are right to be concerned about reducing security on your server through apache modules, but your database and php files will be relatively safe if you use the .htaccess file correctly. Having your own VPS may be the answer. IONOS offer a VPS for @ £1.20 per month, then you have full control.

Frustrating is the word…

I did not say the full path would make it not work, I just addressed the comment from you (I think it was) saying “this looks strange”, when seeing the result in the log. A request for “http://aaaaaa.se/getvalue.php/getvalue” is what my webserver receives when I put http://aaaaaa.se/getvalue.php in the service-URL. The Kodular block for “Tiny WebDB .get” seems to append “getvalue” to the service URL, which is perfectly logical to me. How this is dealt with by the code in the server is another thing. I suppose rewrites in htaccess can solve it, for example.

I still wish I could see the actual request that these Kodularblock sends. Something in the fomrat is apparenlty different to what comes out of the WebBlocks even though logically, it ought to be the same.

Thanks again. You’ve been very helpful!