Embeding streamlit cloud URL with <iframe>

Good day,

I have a question regarding the URL that is generated when an app is deployed to the cloud.

Previously, an app had an URL structure such as the following:

https://share.streamlit.io/postdatacrc/mediciones_qoe/main/Streamlit-Mediciones_QoE.py

Now, when I access the same app from the cloud, the URL direction is:

https://postdatacrc-mediciones-qoe-streamlit-mediciones-qoeookla-3vocxo.streamlitapp.com/

If I try to embed the first URL into another website with HTML code, it poses no error and displays correctly.
The code for doing that is the following:

However, if I use the other URL in the src, the page gets the redirected you too many times error (Although the app works properly).

image

I would appreciate if you could give me some insight about what is different between both URLs, and if there is a way to configure the cloud as to keep getting the previous URL structure.

Thanks.

1 Like

Hi @postdatacrc and welcome to the Streamlit community! If the goal is to embed the Streamlit app hosted on Streamlit cloud, use the format https://xyz.streamlitapp.com/?embedded=true

So for you that would be https://postdatacrc-mediciones-qoe-streamlit-mediciones-qoeookla-3vocxo.streamlitapp.com/?embedded=true

3 Likes

If the goal is to have a predictable easy to share url, is it possible to keep the previous URL structure?
For example, one could share the link https://share.streamlit.io/postdatacrc/mediciones_qoe/main/Streamlit-Mediciones_QoE.py to always send the user to the latest hosted version of the app.

Hey @alskdu, :wave:

In about a week, we’re going to be switching Community Cloud to a unique subdomain structure. All apps will share the same basic url structure like above which should help with predictability. Here’s a post explaining more: Coming soon: New subdomain URL format and customizable subdomains!

Hope this helps :heart:

1 Like

Hey @tc1 , thank you for your response. I did see the change. However, you can see that there is a “short hash” at the end. Is this based on the hash of the latest commit? If it is, wouldn’t the hash change with each deployment? My usecase is that I want to provide a link to every team member that would always take them to the LATEST deployment of the app from main branch, for example. Thanks

Hi - I have a similar question to @alskdu. I am currently embedding an app within an iframe on my website, and want to confirm that the new subdomain structure won’t require me to update my embed URL each time I push a new change to GitHub (the hash?). Can you confirm?

Hi @tc1 , any idea how to solve this issue?

I’m currently getting an error streamlitapp.com redirected you too many times.”

This is happening with a custom URL with an iframe, and always occurs regardless of whether I use the format https://xyz.streamlitapp.com/?embedded=true or https://xyz.streamlitapp.com or https://share.streamlit.xyz.py

This appears to be linked to this thread here

Update: rebooting the app has appeared to solve the issue

Hi @alskdu

Please see responses inline

If the goal is to have a predictable easy to share url, is it possible to keep the previous URL structure?

We are moving away from the previous URL structure to support Custom URLs and also to improve app isolation and security.

However, you can see that there is a “short hash” at the end. Is this based on the hash of the latest commit? If it is, wouldn’t the hash change with each deployment?

The “short hash” is not related in any way to the hash of the latest commit. It is an internal hash used to create a unique subdomain for an app. It prevents collisions with other app subdomains in case they share the same app co-ordinates(repo name, app name, file name etc).

The unique app url is a stable url and does not change with each deployment.

Thanks