Masked Redirect and Refused to display 'http://MY_IP_ADD/index.php/login' in a frame because it set 'X-Frame-Options' to 'Sameorigin'

I have a fresh install of nextcloud running on my raspberry pi at home, I just purchased a domain name and Iā€™m trying to get it all set up. From my domain name control panel if I select ā€œURL redirect recordā€ with the correct settings and the option of ā€œunmaskedā€ everything works as expected, but I donā€™t want my IP address displaying in the address bar, so I leave everything the same except change the ā€œunmaskedā€ option to ā€œmaskedā€ and I get the error in chrome ā€œRefused to display ā€˜http://MY_IP_ADD/index.php/loginā€™ in a frame because it set ā€˜X-Frame-Optionsā€™ to ā€˜Sameoriginā€™ā€

I have already added the domain Cname and IP in the trusted domains, Iā€™m really at a loss here as I donā€™t know how to SAFELY correct for this, I understand this is a security feature so I donā€™t want to disable it, but I would like to know how to allow for a masked redirect from my domain name? If Iā€™ve left out any important info please feel free to ask, I will list some of my setup specs below. Thank you for taking the time to read this

Nextcloud Version: 10.0 (stable)

PHP Version: 5.6.24

Database Type: Mysql

Apache2

Why donā€™t you set the DNS entry to your IP directly (if it is a dynamic ip, your provider perhaps has a dynamic dns service included, if not, you can use a dynamic dns solution and then put this dynamic dns name as a CNAME record in your real domain). This iframe-solution shouldnā€™t be used (it has been disabled for security reasons).

Thank you for your suggestion! My provider does have a dynamic DNS option, however the client itā€™s having me download is a EXE file, but my server is running on a raspberry pi. What client would you recommend for the rpi 2 model B?

@tflidd, thank you for your suggestion, I managed to get it to work!! Although now I have new problemsā€¦

Iā€™m trying to redirect all traffic to https and parts of it are working and other parts, not so muchā€¦ If I navigate to www.MyDomain.com it goes straight to that address, however, if I navigate to MyDomain.com it redirects correctly to https? Iā€™m sure itā€™s just something small Iā€™m missing from a config file but I donā€™t know which one is working when it redirects correctly and which one isnā€™t working when it doesnā€™tā€¦

Any help or suggestions would be greatly appreciated!

Thank you in advance!

You probably have to set the variable
ServerAlias www.MyDomain.com
in your http (<VirtualHost *:80>) vhost.