import{s as pe,n as me,o as ce}from"../chunks/scheduler.9cda857a.js";import{S as fe,i as ue,e as s,s as a,c as S,h as he,a as l,d as i,b as o,f as j,g as x,j as C,k as U,l as c,m as n,n as H,t as L,o as M,p as P}from"../chunks/index.f47f3121.js";import{C as de}from"../chunks/CopyLLMTxtMenu.676ed699.js";import{C as le}from"../chunks/CodeBlock.24d62f98.js";import{H as re,E as $e}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.64d112fc.js";function ge(ee){let r,I,B,Z,f,D,u,W,h,te="In Hugging Face Spaces, applications have certain limitations when using cookies. This is primarily due to the structure of the Spaces’ pages (<code>https://huggingface.co/spaces/&lt;user&gt;/&lt;app&gt;</code>), which contain applications hosted on a different domain (<code>*.hf.space</code>) within an iframe. For security reasons, modern browsers tend to restrict the use of cookies from iframe pages hosted on a different domain than the parent page.",Y,d,J,$,ie="One instance where these cookie restrictions can become problematic is when hosting Streamlit applications using the Docker SDK. By default, Streamlit enables cookie-based XSRF protection. As a result, certain components that submit data to the server, such as <code>st.file_uploader()</code>, will not work properly on HF Spaces where cookie usage is restricted.",R,g,ne="To work around this issue, you would need to set the <code>server.enableXsrfProtection</code> option in Streamlit to <code>false</code>. There are two ways to do this:",X,p,w,v,ae="Command line argument: The option can be specified as a command line argument when running the Streamlit application. Here is the example command:",Q,b,G,y,T,oe="Configuration file: Alternatively, you can specify the option in the Streamlit configuration file <code>.streamlit/config.toml</code>. You would write it like this:",N,k,A,m,se="<p>When you are using the Streamlit SDK, you don’t need to worry about this because the SDK does it for you.</p>",K,_,z,E,F;return f=new de({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),u=new re({props:{title:"Cookie limitations in Spaces",local:"cookie-limitations-in-spaces",headingTag:"h1"}}),d=new re({props:{title:"Impact on Hosting Streamlit Apps with Docker SDK",local:"impact-on-hosting-streamlit-apps-with-docker-sdk",headingTag:"h2"}}),b=new le({props:{code:"c3RyZWFtbGl0JTIwcnVuJTIwYXBwLnB5JTIwLS1zZXJ2ZXIuZW5hYmxlWHNyZlByb3RlY3Rpb24lMjBmYWxzZQ==",highlighted:"streamlit run app.py --server.enableXsrfProtection false",wrap:!1}}),k=new le({props:{code:"JTVCc2VydmVyJTVEJTBBZW5hYmxlWHNyZlByb3RlY3Rpb24lMjAlM0QlMjBmYWxzZQ==",highlighted:`<span class="hljs-section">[server]</span>
<span class="hljs-attr">enableXsrfProtection</span> = <span class="hljs-literal">false</span>`,wrap:!1}}),_=new $e({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/spaces-cookie-limitations.md"}}),{c(){r=s("meta"),I=a(),B=s("p"),Z=a(),S(f.$$.fragment),D=a(),S(u.$$.fragment),W=a(),h=s("p"),h.innerHTML=te,Y=a(),S(d.$$.fragment),J=a(),$=s("p"),$.innerHTML=ie,R=a(),g=s("p"),g.innerHTML=ne,X=a(),p=s("ol"),w=s("li"),v=s("p"),v.textContent=ae,Q=a(),S(b.$$.fragment),G=a(),y=s("li"),T=s("p"),T.innerHTML=oe,N=a(),S(k.$$.fragment),A=a(),m=s("blockquote"),m.innerHTML=se,K=a(),S(_.$$.fragment),z=a(),E=s("p"),this.h()},l(e){const t=he("svelte-u9bgzb",document.head);r=l(t,"META",{name:!0,content:!0}),t.forEach(i),I=o(e),B=l(e,"P",{}),j(B).forEach(i),Z=o(e),x(f.$$.fragment,e),D=o(e),x(u.$$.fragment,e),W=o(e),h=l(e,"P",{"data-svelte-h":!0}),C(h)!=="svelte-1domup1"&&(h.innerHTML=te),Y=o(e),x(d.$$.fragment,e),J=o(e),$=l(e,"P",{"data-svelte-h":!0}),C($)!=="svelte-ulqtw2"&&($.innerHTML=ie),R=o(e),g=l(e,"P",{"data-svelte-h":!0}),C(g)!=="svelte-rjiuoj"&&(g.innerHTML=ne),X=o(e),p=l(e,"OL",{});var O=j(p);w=l(O,"LI",{});var V=j(w);v=l(V,"P",{"data-svelte-h":!0}),C(v)!=="svelte-1h01oe1"&&(v.textContent=ae),Q=o(V),x(b.$$.fragment,V),V.forEach(i),G=o(O),y=l(O,"LI",{});var q=j(y);T=l(q,"P",{"data-svelte-h":!0}),C(T)!=="svelte-1tebkxx"&&(T.innerHTML=oe),N=o(q),x(k.$$.fragment,q),q.forEach(i),O.forEach(i),A=o(e),m=l(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),C(m)!=="svelte-18476cb"&&(m.innerHTML=se),K=o(e),x(_.$$.fragment,e),z=o(e),E=l(e,"P",{}),j(E).forEach(i),this.h()},h(){U(r,"name","hf:doc:metadata"),U(r,"content",we),U(m,"class","tip")},m(e,t){c(document.head,r),n(e,I,t),n(e,B,t),n(e,Z,t),H(f,e,t),n(e,D,t),H(u,e,t),n(e,W,t),n(e,h,t),n(e,Y,t),H(d,e,t),n(e,J,t),n(e,$,t),n(e,R,t),n(e,g,t),n(e,X,t),n(e,p,t),c(p,w),c(w,v),c(w,Q),H(b,w,null),c(p,G),c(p,y),c(y,T),c(y,N),H(k,y,null),n(e,A,t),n(e,m,t),n(e,K,t),H(_,e,t),n(e,z,t),n(e,E,t),F=!0},p:me,i(e){F||(L(f.$$.fragment,e),L(u.$$.fragment,e),L(d.$$.fragment,e),L(b.$$.fragment,e),L(k.$$.fragment,e),L(_.$$.fragment,e),F=!0)},o(e){M(f.$$.fragment,e),M(u.$$.fragment,e),M(d.$$.fragment,e),M(b.$$.fragment,e),M(k.$$.fragment,e),M(_.$$.fragment,e),F=!1},d(e){e&&(i(I),i(B),i(Z),i(D),i(W),i(h),i(Y),i(J),i($),i(R),i(g),i(X),i(p),i(A),i(m),i(K),i(z),i(E)),i(r),P(f,e),P(u,e),P(d,e),P(b),P(k),P(_,e)}}}const we='{"title":"Cookie limitations in Spaces","local":"cookie-limitations-in-spaces","sections":[{"title":"Impact on Hosting Streamlit Apps with Docker SDK","local":"impact-on-hosting-streamlit-apps-with-docker-sdk","sections":[],"depth":2}],"depth":1}';function be(ee){return ce(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends fe{constructor(r){super(),ue(this,r,be,ge,pe,{})}}export{Se as component};
