Hi Nick,
I had the same problem and finally managed to solve it.
First, let me explain the problem. To see why e.g. Chrome is not loading the iFrame from DSMR reader, hit F12 in Chrome to enter the devoloper tools. Hit F5 to reload and the error should appear. In my case, I got the following error.
Refused to display 'https://www.mysite.nl:8124/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
After some searching I found that this is a setting of your webserver, in our case Nginx, which was installed with DSMR-reader. It is protecting your DSMR reader website from being included in iFrames on websites different than the same server as where DSMR reader is running from. In my case, www.mywebsite.nl is reffering to my Synology (with a redirect to my raspberry), whereas DSMR reader is running on my raspberry.
First I tried to add the following line to my dsmr-webinterface.conf configuration file (in /etc/nginx/sites-enabled/).
add_header X-Frame_Option "ALLOW-FROM https://www.mysite.nl:8123/dsmr";
After reloading nginx I received an error about having conflicting values
Multiple 'X-Frame-Options' headers with conflicting values ('ALLOW-FROM https://www.mysite.nl:8124, SAMEORIGIN')
So, I changed back the file to the original state and I started looking where the âSAMEORIGINâ setting was defined. It turned out that it was not defined in the Nginx configuration files, but in the Django settings of the DSMR reader frontend. To change it, modify the following file: /home/dsmr/dsmr-reader/dsmrreader/config/base.py. Look for the following text and comment out the line with âdjango.middleware.clickjacking.XFrameOptionsMiddlewareâ, this is the line that is setting the X-Frame-Options to âSAMEORIGINâ.
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',**
'django.middleware.security.SecurityMiddleware',
# Local.
'dsmr_frontend.middleware.exception_traceback.ExceptionTracebackMiddleware',
)
After changing this, reload the DSMR reader and you should be all set.
sudo supervisorctl
reread
update
Hope this will help you out. See you in the office monday
Note. For extra security, you can add the following line in your Nginx configuration file.
add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' https://www.mysite.nl:*";