ptpb / pb

pb is a formerly-lightweight pastebin and url shortener
Other
553 stars 52 forks source link

Deleting a(n) (image) paste doesn't seem to work on ptpb.pw #185

Closed MacGyverNL closed 7 years ago

MacGyverNL commented 7 years ago

As in the title, deleting a paste per the documentation doesn't seem to work.

curl -F c=@image.png https://ptpb.pw Status: created, get UUID. Load paste in browser.

curl -X DELETE https://ptpb.pw/UUID Status: deleted

Paste still loads in browser, in different browser, and third party can also still load paste.

buhman commented 7 years ago

Hmm. Yeah, I reproduced this.

$ curl -X DELETE https://ptpb.pw/83f86795-e58d-4fba-a7aa-54c5a9d40851
date: 2017-03-17T18:33:38.163000+00:00
digest: f268da0b4d8a3f1ad1e535592ff9897c75c81bfe
long: APJo2gtNij8a0eU1WS_5iXx1yBv-
short: yBv-
size: 1131046
status: deleted
url: https://ptpb.pw/yBv-
$ curl -sD- -o /dev/null https://ptpb.pw/yBv-.png                    
HTTP/1.1 200 OK
Server: nginx/1.10.0 (Ubuntu)
Date: Fri, 17 Mar 2017 18:34:49 GMT
Content-Type: image/png
Content-Length: 1131046
Connection: keep-alive
Access-Control-Allow-Origin: *
ETag: "paste-f268da0b4d8a3f1ad1e535592ff9897c75c81bfe"
Cache-Control: public, max-age=43200
X-Varnish: 1148307 1148300
Age: 51
Via: 1.1 varnish-v4
Accept-Ranges: bytes

So the deleted response means the paste was definitely deleted, and definitely doesn't exist anymore.

You'll also notice the Age: 51 header, which means you got a cached response instead of one from pb itself, also max-age=43200 which means varnish (and potentially any other foreign caching layers) will hold it for up to 43,200 seconds.

buhman commented 7 years ago

The current ptpb deployment was missing the cache invalidation configuration directive, VARNISH_BASE. I've added this to the deployment, and this works for me now.

Let me know if you disagree.