Php code nnot working in iframe

Hi I used some very basic php code and it is not displayed if I use iframe.
<?php echo 'TEST'; ?>

It is working if I access my HA with hostname but if local ip is used it is not resolving php code.

This is my card config.

type: custom:config-template-card
entities:
  - null
card:
  type: iframe
  title: null
  url: http://192.168.188.201:20530
  allow_open_top_navigation: true

So if I replace IP in url with hostname it works. Very strange, any clue?

Does it work in a plain browser with http://192.168.188.201:20530?
If not, the problem is unrelated to HA…

Of course it is working, as well with hostname it works.

Well, anyway, an iframe is between your browser and your php server.
Did you try with an iframe out of HA context?

1 Like

Just tested and it is working out of HA context.

I created a new website under http://192.168.188.203:20555 and added iframe pointing to http://192.168.188.201:20530.

My HA is running under http://192.168.188.203:20536 but if I open HA with http://1nuc.mooo.com:20536 then it works.

I just figured it our, if I add Header unset X-Content-Type-Options in my apache config it is working now.