# Matlab app with matlab-proxy and CSP frame-ancestors

**URL:** https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969
**Category:** Get Help
**Created:** [January 17, 2025, 1:19pm UTC](https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969 "2025-01-17T13:19:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anderss](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/anderss/32/3359_2.png) [@anderss](https://discourse.openondemand.org/u/anderss)
#### Post date: [January 17, 2025, 1:19pm UTC](https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969/1 "2025-01-17T13:19:41Z")

</div>

Hi OOD Community,

In case you are interested in using the excellent [matlab-proxy](https://github.com/mathworks/matlab-proxy) package for your Matlab OOD app, I have a quick tip for you. I am not a web-developer, so please excuse my poor explanations below.

There has been a OOD portal configuration (`ood_portal.yml`) variable called `security_csp_frame_ancestors` since at least OOD version 1.8. As [explained here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors), this Content-Security-Policy (CSP) directive specifies what sources can embed content via frames or iframes in a given page. Be default, the `security_csp_frame_ancestors` variable is set to the hostname of the OOD host.

Well, it turns out that the `matlab-proxy` embeds the Matlab interface within a frame. **If you use any other domain other than the OOD host (for instance, an alias like `login.cluster.school.edu`), the frame content is being delivered to another domain that is not permitted by the CSP rules, and the default behavior is for the browser to block the content entirely.**

To fix this, you can set the value of `security_csp_frame_ancestors` to include both the OOD server and **your alternate domains** like this:

```auto
security_csp_frame_ancestors: "https://ondemand.school.edu https://login.cluster.school.edu"
# or for multiple subdomains
security_csp_frame_ancestors: "https://ondemand.school.edu https://*.cluster.school.edu"

```

Generate the portal again, restart HTTPD and your Matlab app should work great.

---

<div class="post-metadata">

### Author: ![mjbludwig](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mjbludwig/32/684_2.png) [@mjbludwig](https://discourse.openondemand.org/u/mjbludwig)
#### Post date: [January 17, 2025, 6:43pm UTC](https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969/2 "2025-01-17T18:43:30Z")

</div>

Interesting. I have not had to do that for it when running OOD 3.0.1.

I definitely want to second though that the matlab-proxy is a huge improvement over having to run it in a virtual desktop.

---

<div class="post-metadata">

### Author: ![anderss](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/anderss/32/3359_2.png) [@anderss](https://discourse.openondemand.org/u/anderss)
#### Post date: [January 18, 2025, 2:50pm UTC](https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969/3 "2025-01-18T14:50:49Z")

</div>

Morgan, your comment made me go back and look at my notes and I have updated my post above (corrections in bold) to try and better explain the issue and solution.

It works fine if you are logging in to a domain that matches the OOD server name – the problem only occurs when using alternate domains/aliases.

---

<div class="post-metadata">

### Author: ![mjbludwig](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mjbludwig/32/684_2.png) [@mjbludwig](https://discourse.openondemand.org/u/mjbludwig)
#### Post date: [January 20, 2025, 7:51pm UTC](https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969/4 "2025-01-20T19:51:35Z")

</div>

Gotcha! Good to know!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)
#### Post date: [July 19, 2025, 7:51pm UTC](https://discourse.openondemand.org/t/matlab-app-with-matlab-proxy-and-csp-frame-ancestors/3969/5 "2025-07-19T19:51:54Z")

</div>

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