Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kedro-viz embedded as an IFrame #1658

Merged
merged 6 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint
Signed-off-by: Rashida Kanchwala <rashida.kanchwala@quantumblack.com>
rashidakanchwala committed Nov 28, 2023
commit 33faec41f3afeb3b45e7ef8b739f3d74423d5c6c
6 changes: 4 additions & 2 deletions package/kedro_viz/api/apps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""`kedro_viz.api.app` defines the FastAPI app to serve Kedro data in a RESTful API.
This data could either come from a real Kedro project or a file.
"""
import os
import json
import os
import time
from pathlib import Path

@@ -22,6 +22,7 @@

_HTML_DIR = Path(__file__).parent.parent.absolute() / "html"


def _create_etag() -> str:
"""Generate the current timestamp to use as etag."""
return str(time.time())
@@ -35,8 +36,9 @@ def _create_base_api_app() -> FastAPI:
default_response_class=EnhancedORJSONResponse,
)

if os.getenv('ADD_SECURITY_HEADERS', '').lower() == 'true':
if os.getenv("ADD_SECURITY_HEADERS", "").lower() == "true":
secure_headers = secure.Secure()

@app.middleware("http")
async def set_secure_headers(request, call_next):
response = await call_next(request)