]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/bugs/aggregate_web_trigger_sends_response_as_text__47__plain.mdwn
in error case
[git.ikiwiki.info.git] / doc / bugs / aggregate_web_trigger_sends_response_as_text__47__plain.mdwn
1 With IkiWiki 3.20200202.3, [[plugins/aggregate]]'s web trigger sends it's response as HTTP 200, Content-Type: text/plain, followed by a payload that seems to include a Content-type in the body accidentally, and a bunch of HTML:
4     qusp▶ GET -e "https://$redacted/ikiwiki?do=aggregate_webtrigger"
5     Enter username for Git Access at REDACTED:443: admin
6     Password: 
7     200 OK
8     Connection: close
9     Date: Mon, 20 Apr 2020 08:27:39 GMT
10     Server: nginx/1.14.2
11     Content-Length: 2467
12     Content-Type: text/plain
13     Client-Date: Mon, 20 Apr 2020 08:27:39 GMT
14     Client-Peer: 31.51.75.214:443
15     Client-Response-Num: 1
16     Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
17     Client-SSL-Cert-Subject: /CN=REDACTED
18     Client-SSL-Cipher: ECDHE-RSA-CHACHA20-POLY1305
19     Client-SSL-Socket-Class: IO::Socket::SSL
20     
21     Aggregation triggered via web.
22     
23     Content-type: text/html
24     
25     <!DOCTYPE html>
26     <html xmlns="http://www.w3.org/1999/xhtml">
27     <head>
28     …
30 Looking at the source it's fairly clear why:
31 <http://source.ikiwiki.branchable.com/?p=source.git;a=blob;f=IkiWiki/Plugin/aggregate.pm;hb=HEAD#l76>
33 I guess it was never intended for a human to see this output. I've found it useful to add a link button to some private pages to manually trigger the web hook,
34 something like
36     <a class=feedbutton href=https://REDACTED/ikiwiki?do=aggregate_webtrigger>webtrigger</a>
38 So it would be nice if the payload was sent with a HTML content-type (which wouldn't hurt cron jobs or clients that ignore the body anyway)
40 *— [[Jon]], 2020-04-20*
42 > Oh, haha, the issue here is that the aggregation is *failing*. In the failure case, the above happens (there's an error wrapped up in HTML and delivered as text/plain).
43 > In the success case, the output to browser is just plain text. 
44 > *— [[Jon]], 2020-04-20*