# Protocol agnostic CDN URLs are problematic

**URL:** https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301
**Category:** Feature
**Created:** [February 19, 2019, 1:51pm UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301 "2019-02-19T13:51:23Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [February 19, 2019, 1:51pm UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/1 "2019-02-19T13:51:23Z")

</div>

So one potential issue I’ve found was that I was using

`//cdn-url.example.com`

in my `app.yml` – changing it to

`https://cdn-url.example.com`

made things better, there are no errors now.

---

<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: [March 30, 2019, 6:41am UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/2 "2019-03-30T06:41:41Z")

</div>

Yes, I had the same problem @itsbhanusharma. It’s too bad our default CSP policy doesn’t allow CDN URLs of the protocol agnostic form

`//discourse.cdn.example.com`

Is there some reason why we hard-coded this to https instead of being protocol agnostic @sam? Does CSP require https?

---

<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: [March 30, 2019, 6:47am UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/3 "2019-03-30T06:47:35Z")

</div>

Protocol agnostic CDN is a bad practice, we should not be using that anywhere really.

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [April 2, 2019, 1:58pm UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/4 "2019-04-02T13:58:36Z")

</div>

Besides, CSP specification mandates the protocol [scheme](https://tools.ietf.org/html/rfc3986#section-3.1) to start with a letter, which rules out the `//`; or to use no protocol at all (just the hostname, or [`none`, or `self`, etc.](https://www.w3.org/TR/CSP3/#framework-directive-source-list)) – which also works, but indeed the mix of HTTPS and HTTP already causes browsers (at least Firefox) to turn the green lock into a grey lock with an orange warning sign. No very user friendly.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [April 3, 2019, 5:29am UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/5 "2019-04-03T05:29:31Z")

</div>

Should we just silently convert a schemeless CDN to https on config file load?

---

<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: [April 3, 2019, 5:51am UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/6 "2019-04-03T05:51:44Z")

</div>

mayyyyybe… I kind of prefer not to cause we will still be lumped with fixing all history with a remap anyway.

---

<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: [April 3, 2019, 5:53am UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/7 "2019-04-03T05:53:44Z")

</div>

I think a rebuild should freak out if it sees a CDN beginning with `//` and return a console error advising the user that this is a bad practice, and refuse to progress.

---

<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: [April 3, 2019, 6:02am UTC](https://meta.discourse.org/t/protocol-agnostic-cdn-urls-are-problematic/113301/8 "2019-04-03T06:02:33Z")

</div>

Sure… why not

[https://github.com/discourse/discourse\_docker/commit/49bc616a963994715b02f792776acf1388314086](https://github.com/discourse/discourse_docker/commit/49bc616a963994715b02f792776acf1388314086)
