PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, December 3, 2022

[FIXED] How to access a website deployed on heroku from an iframe?

 December 03, 2022     django, heroku, iframe     No comments   

Issue

I created a website in Django that I deployed on heroku. It contains the following line in its settings.py file:

ALLOWED_HOSTS = ['*']

This means that it allows connection with any domain name. But when I try to access a site from an iframe on an html page from my localhost, I get the following error when loading my webpage:

gkwhelps.herokuapp.com refused the connection.

here is the code of my iframe:

<Iframe src="https://gkwhelps.herokuapp.com"
                            width="450px"
                            height="450px"
                            />

I don't know why this happens because I authorized access to all hosts before deploying on heroku, I don't know if heroku has a policy about this which conditions the access to other hosts or the error comes from elsewhere. Thanks !


Solution

If you look at the headers of your Heroku app, you will see the following:

X-Frame-Options: DENY

This means that Heroku refuses to accept iframe connections - hence the error you have received.



Answered By - 0sVoid
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing