# CORS policy errors when accessing a server behind a reverse proxy when using the app.plex.tv url

**URL:** https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109
**Category:** Remote Access
**Tags:** server-linux, plex-web
**Created:** [March 20, 2023, 11:06am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109 "2023-03-20T11:06:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![PeacefulMountain](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@PeacefulMountain](https://forums.plex.tv/u/PeacefulMountain)
#### Post date: [March 20, 2023, 11:06am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/1 "2023-03-20T11:06:04Z")

</div>

Server Version#: 1.31.1.6733  
Player Version#: Web

I have a server behind a reverse proxy that’s fully accessible at a custom domain I control. I have placed the following domain in the “Custom server access URLs”:  
[https://plex.mydomain.tld:443](https://plex.mydomain.tld:443)

This works perfectly fine, except when accessing the server in a web browser with the app.plex.tv url as some quirky behavior is exhibited. Essentially I can’t change anything, subtitles, quality, settings. When looking at the JS console I see these errors:

```auto
Access to XMLHttpRequest at 'https://plex.mydomain.tld/updater/check?download=0&X-Plex-Product=Plex%20Web&X-Plex-Version=4.103.2&X-Plex-Client-Identifier=XXXXXX&X-Plex-Platform=Chrome&X-Plex-Platform-Version=111.0&X-Plex-Features=external-media%2Cindirect-media%2Chub-style-list&X-Plex-Model=hosted&X-Plex-Device=Windows&X-Plex-Device-Name=Chrome&X-Plex-Device-Screen-Resolution=1920x1049%2C1920x1200&X-Plex-Token=XXXXXX&X-Plex-Language=en' from origin 'https://app.plex.tv' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

PUT https://plex.mydomain.tld/updater/check?download=0&X-Plex-Product=Plex%20Web&X-Plex-Version=4.103.2&X-Plex-Client-Identifier=XXXXXX&X-Plex-Platform=Chrome&X-Plex-Platform-Version=111.0&X-Plex-Features=external-media%2Cindirect-media%2Chub-style-list&X-Plex-Model=hosted&X-Plex-Device=Windows&X-Plex-Device-Name=Chrome&X-Plex-Device-Screen-Resolution=1920x1049%2C1920x1200&X-Plex-Token=XXXXXX&X-Plex-Language=en net::ERR_FAILED

```

The strange thing is that I have another server with an identical setup involving a reverse proxy and it works completely fine, totally rock solid with no errors. It’s just this new setup I’m making that’s causing problems.

---

<div class="post-metadata">

### Author: ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)
#### Post date: [March 20, 2023, 4:16pm UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/2 "2023-03-20T16:16:47Z")

</div>

If you have two servers

- Same PMS version
- Same account
- One works but one doesn’t

Doesn’t it seem logical the root problem is in the proxy configuration on the new machine?

---

<div class="post-metadata">

### Author: ![PeacefulMountain](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@PeacefulMountain](https://forums.plex.tv/u/PeacefulMountain)
#### Post date: [March 20, 2023, 8:14pm UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/3 "2023-03-20T20:14:43Z")

</div>

Yes, through further troubleshooting I fully believe it’s the proxy configuration on the new machine. However, it’s unclear how to fix it. The new machine uses traefic while the old one uses nginx, and it’s unclear what is misconfigured.

---

<div class="post-metadata">

### Author: ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)
#### Post date: [March 20, 2023, 10:42pm UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/4 "2023-03-20T22:42:13Z")

</div>

That’s why I opted to use the bigger hammer – PfSense 🕶

---

<div class="post-metadata">

### Author: ![PeacefulMountain](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@PeacefulMountain](https://forums.plex.tv/u/PeacefulMountain)
#### Post date: [March 21, 2023, 12:18am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/5 "2023-03-21T00:18:15Z")

</div>

As far as I can tell tell traefic on my truenas scale server is not adding the correct `accessControlAllowOrigin` header. With it’s current implementation I don’t think I’m able to diagnose further.

---

<div class="post-metadata">

### Author: ![Krazeh](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/krazeh/32/81905_2.png) [@Krazeh](https://forums.plex.tv/u/Krazeh)
#### Post date: [March 21, 2023, 12:45am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/6 "2023-03-21T00:45:50Z")

</div>

Plex can run absolutely fine behind traefik. What is your current setup?

---

<div class="post-metadata">

### Author: ![PeacefulMountain](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@PeacefulMountain](https://forums.plex.tv/u/PeacefulMountain)
#### Post date: [March 21, 2023, 3:48am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/7 "2023-03-21T03:48:22Z")

</div>

Basically just:

- A truenas scale server
- Truecharts [plex](https://truecharts.org/charts/stable/plex/) and [traefik](https://truecharts.org/charts/enterprise/traefik/)
- Standard configuration of plex, with an ingress, load balancer service type, no middleware set.
- plex.mydomain.tld added in plex network config.

It’s important to realize that If I connect to my server via plex.mydomain.tld it works totally fine. But if I just go to plex.tv (as people who I’ve shared the server with might do), then that results in cors errors.

This same error does not occur when using nginx that I’ve successfully deployed on a different plex server. As a stop gap measure, I adjusted my dns to go to my other server, run through an nginx reverse proxy, and forward that request to my truenas server on the exposed 32400 port. This works ok, no errors, albeit suboptimal. Besides the network hop the remote IP apparently isn’t getting forwarded correctly. Not sure how to fix that at this moment.

I’m not sure of your familiarity with truenas scale but the implementation of [traefik](https://truecharts.org/charts/enterprise/traefik/) is with [truecharts](https://truecharts.org/) and it is missing a substantial amount of control and features of the actual full featured traefik. They have reasonable brute force defaults but I’ve determined I can’t diagnose this further without further implementation of the header middleware. Such as just setting the policy to \*.

I have brought this up with the developers of the truecharts traefik and they just weren’t that concerned with it. Adding the header middleware feature set [has been on the radar for months](https://github.com/truecharts/charts/issues/3952) but since it’s an open source project we’ll probably have to wait months and maybe years until someone contributes to that.

Unless you have other ideas, to which I’m entirely willing to try.

---

<div class="post-metadata">

### Author: ![PeacefulMountain](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@PeacefulMountain](https://forums.plex.tv/u/PeacefulMountain)
#### Post date: [March 21, 2023, 4:35am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/8 "2023-03-21T04:35:47Z")

</div>

The only think stopping me from getting a pfsense setup is buying a new server box. Any recommendations? Care to share what you’ve got?

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)
#### Post date: [June 19, 2023, 4:36am UTC](https://forums.plex.tv/t/cors-policy-errors-when-accessing-a-server-behind-a-reverse-proxy-when-using-the-app-plex-tv-url/835109/9 "2023-06-19T04:36:45Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
