Resolved: Plotly Dash in Kubernetes pod cannot get assets for IFrame


The idea is to display .html file in html.iFrame in Plotly Dash hosted in Kubernetes.
The code works as intended in local however it’s met with 404 ( in K8s log ) when trying to fetch the file in the pod (/project/assets/). I have went into the pod to check and the files are there. I have checked for file permissions and they are the same as local (-rw-r–r–), parents folders have the same permissions too. I have some other files in /project/cache folders that can be successfully displayed through dcc.Graph indicating that io is fine. - - [04/Feb/2022 02:41:58] "POST /_dash-update-component HTTP/1.1" 200 - - - [04/Feb/2022 02:41:58] "GET /assets/country/datetime/filename.html HTTP/1.1" 404 -
Is there something unique about html.iFrame in Kubernetes that I have missed out? My apologies if the question is too terse but I am not even sure where or how to start debugging.
Update 1: Found useful reference ( )


Solved using srcDoc instead of src.
with open(f"assets/{filename}", "r") as f:
    html_content =

content = html.Iframe(srcDoc=f"{html_content}", style={"height": "1067px", "width": "98%"})

If you have better answer, please add a comment about this, thank you!


If you like this answer, you can give me a coffee by click here (view Ads)