Re: [tw5] Webserver: PUT request failing with error

54 views
Skip to first unread message

Xavier Cazin

unread,
May 31, 2020, 6:31:49 AM5/31/20
to tiddl...@googlegroups.com
Hi Riz,

You need to add -H "X-Requested-With: TiddlyWiki" in your command (see https://tiddlywiki.com/#WebServer%20Parameter%3A%20csrf-disable)

Regards,
-- Xavier.

On Tue, May 26, 2020 at 3:53 AM Riz <madapeed...@gmail.com> wrote:
I created an empty server wiki and added a tiddler with title "New". GET request against "http://127.0.0.1:8080/recipes/default/tiddlers/New" returns proper response. However various attempts at PUT request fails with the following error message.

HTTP/1.1 403 'X-Requested-With' header required to login to 'My ~TiddlyWiki'
Date: Tue, 26 May 2020 01:43:14 GMT
Connection: keep-alive
Transfer-Encoding: chunked


Commands I attempted

curl -X PUT -i 'http://127.0.0.1:8080/recipes/default/tiddlers/New' --data '{
    "title": "New",
    "tags": "FirstTag [[Second Tag]]",
    "my-custom-field": "Field value"
}'



curl
-X PUT -H 'Content-Type: application/json' -i 'http://127.0.0.1:8080/recipes/default/tiddlers/New' --data '{
    "title": "New",
    "tags": "FirstTag [[Second Tag]]",
    "my-custom-field": "Field value"
}'




curl
-X PUT -H 'X-Requested-With: XMLHttpRequest' -H 'Content-Type: application/json' -i 'http://127.0.0.1:8080/recipes/default/tiddlers/New' --data '{
    "title": "New",
    "tags": "FirstTag [[Second Tag]]",
    "my-custom-field": "Field value"
}

curl -X GET -H '
X-Requested-With: XMLHttpRequest' -i 'http://127.0.0.1:8080/recipes/default/tiddlers/New' --data '{
   
"title": "New",
   
"tags": "FirstTag [[Second Tag]]",
   
"fields": {
       
"my-custom-field": "Field value"        
   
}
}'


Is there a value of X-Requested-With header that is necessary?

Anyone who successfully managed to issue a PUT request against the TW-Server, could you furnish the command you issued?

Sincerely,
Riz

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/ecd1fceb-fc68-4464-a4cc-d1044ba6239f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages