# How can Discourse make POST instead of DELETE for "smart" CDN?

**URL:** https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666
**Category:** Support
**Created:** [2016 年5 月 4 日 13:46 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666 "2016-05-04T13:46:59Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![louirobert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louirobert/32/62262_2.png) [@louirobert](https://meta.discourse.org/u/louirobert)
#### Post date: [2016 年5 月 4 日 13:46 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/1 "2016-05-04T13:46:59Z")

</div>

To delete a topic, Discourse makes a request like:

DELETE [http://example.com/t/123](http://example.com/t/123)

However my CDN doesn’t support DELETE method, but only GET, HEAD, POST, and OPTIONS. I remember that Rails can make a POST request instead of DELETE by adding a “\_method” request variable. So how can I config Discourse to do that?

BTW, my CDN is a kind of “smart” CDN that I just tell it my domain name and do some config on DNS without settings on Discourse part and it will speed my site by caching small files like images and css automatically. So in a word, all client requests, including the DELETE one, go through the CDN server first. Then the CDN server decides to return cached files directly or to go further to my original server next.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年5 月 4 日 14:56 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/2 "2016-05-04T14:56:17Z")

</div>

Why don’t you use the built in CDN support, available by editing `app.yml`? See the #howto topic.

---

<div class="post-metadata">

### Author: ![louirobert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louirobert/32/62262_2.png) [@louirobert](https://meta.discourse.org/u/louirobert)
#### Post date: [2016 年5 月 4 日 14:58 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/3 "2016-05-04T14:58:50Z")

</div>

I saw that. But my CDN vendor, which is also my host vendor, doesn’t support that way. BTW, I’m from China, and my choices are limited. What’s more, that way also has an advantage that it can speed the user uploaded images like avatars.

---

<div class="post-metadata">

### Author: ![louirobert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louirobert/32/62262_2.png) [@louirobert](https://meta.discourse.org/u/louirobert)
#### Post date: [2016 年5 月 5 日 10:41 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/4 "2016-05-05T10:41:11Z")

</div>

Could anyone point me how-to? Or give me some clue? I can modify the code myself.

---

<div class="post-metadata">

### Author: ![louirobert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louirobert/32/62262_2.png) [@louirobert](https://meta.discourse.org/u/louirobert)
#### Post date: [2016 年10 月 2 日 02:15 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/6 "2016-10-02T02:15:32Z")

</div>

I think it’s great to make an option in admin panel to allow POST for DELETE. This is not only for CDN but may also for servers, proxies that don’t support DELETE. And it’s especially useful for the kind of _smart_ CDN, which can speed up all images, including user uploaded ones, but may not support DELETE method. Aliyun CDN, one of the biggest in China, is just such an example.

BTW, I’ve made a patch of code to use POST for DELETE at [GitHub - coin8086/discourse-ajax: Discourse Ajax patch for CDN/server that doesn't support HTTP DELETE method · GitHub](https://github.com/coin8086/discourse-ajax). You see it’s not difficult.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年10 月 3 日 16:53 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/7 "2016-10-03T16:53:06Z")

</div>

If you want to submit a pull request with this option, default OFF, then we are open to it.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019 年3 月 12 日 16:45 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/8 "2019-03-12T16:45:53Z")

</div>



---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2019 年3 月 13 日 04:05 UTC](https://meta.discourse.org/t/how-can-discourse-make-post-instead-of-delete-for-smart-cdn/43666/9 "2019-03-13T04:05:51Z")

</div>


