I am trying to build a SPA which would input box that would take a Gradio Link, (Gradio is simple tool to build Interface for ML Models). Now, I am using an Iframe that takes the user input URL and displays the result. Something like:
Problem is Gradio Link should not be kept open and some authorizations need to be kept.
Approach 1: Tried using Axios get request to make request to URL and display the content in iframe as srcDoc, but while trying to run the model in iframe it fails as returned HTML file as relative paths, example /run/predict.
Approach 2: Tried directly using
<iframe src={url}/>
, assuming origin Cookie (SPA authentication tokens) would be transferred to destination where I can verify User and send the response, but the cookies in the origin domain are not being transferred to source URL.
Now, for method 1 I need to intercept all the request going out from nextjs with user input URL, example /run/predict to url/run/predict. Nextjs Allows to proxy but when request is of type api/run/predict.
For method 2: I need to send the origin cookie to destination (Source URL). Tried, setting cookie sameSite: None, and secure to true, but still not receiving cookies on destination URL.
Can anyone help me with what could be a possible solution for method 1 or 2 or I am approaching wrong way then please suggest me with right one.