Spring boot application : local URL doesn’t load in an IFrame

Problem : Application URLs (local urls) not loading in iframe inside an application UI.

Reason : Spring sets the X-Frame-Options to Deny by default.

Fix : Allow Same-origin-URLs in frames.

In Security configuration, add –

[java]
http
.headers().frameOptions().sameOrigin()
.and
.//other configs

[/java]

Sreekumar Kj
Sreekumar (KJ) has been a hobby programmer from school days. Codemarvels is his personal blog from the year 2010, where he writes about technology, philosophy, society and a bit about physics. He now runs a conversational AI company - DheeYantra - focusing his efforts to help businesses improve operational efficiency using digital employees powered by AI.