import{s as ne,o as oe}from"../chunks/scheduler.d6170356.js";import{S as se,i as le,g as l,s as o,r as H,A as re,h as r,f as a,c as s,j as C,u as L,x as M,k as te,y as f,a as i,v as P,d as B,t as D,w as j,m as ce,n as pe}from"../chunks/index.fcd4cc08.js";import{T as me}from"../chunks/Tip.b09c67cf.js";import{C as ae}from"../chunks/CodeBlock.7b16bdef.js";import{H as ie}from"../chunks/Heading.8660bd0e.js";function fe(I){let n;return{c(){n=ce("When you are using the Streamlit SDK, you don't need to worry about this because the SDK does it for you.")},l(c){n=pe(c,"When you are using the Streamlit SDK, you don't need to worry about this because the SDK does it for you.")},m(c,h){i(c,n,h)},d(c){c&&a(n)}}}function he(I){let n,c,h,W,u,Z,d,N="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.",E,$,Y,g,O="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.",A,w,G="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:",J,p,_,v,U="Command line argument: The option can be specified as a command line argument when running the Streamlit application. Here is the example command:",z,y,Q,S,T,ee="Configuration file: Alternatively, you can specify the option in the Streamlit configuration file <code>.streamlit/config.toml</code>. You would write it like this:",q,b,K,m,R,x,X;return u=new ie({props:{title:"Cookie limitations in Spaces",local:"cookie-limitations-in-spaces",headingTag:"h1"}}),$=new ie({props:{title:"Impact on Hosting Streamlit Apps with Docker SDK",local:"impact-on-hosting-streamlit-apps-with-docker-sdk",headingTag:"h2"}}),y=new ae({props:{code:"c3RyZWFtbGl0JTIwcnVuJTIwYXBwLnB5JTIwLS1zZXJ2ZXIuZW5hYmxlWHNyZlByb3RlY3Rpb24lMjBmYWxzZQ==",highlighted:"streamlit run app.py --server.enableXsrfProtection false",wrap:!1}}),b=new ae({props:{code:"JTVCc2VydmVyJTVEJTBBZW5hYmxlWHNyZlByb3RlY3Rpb24lMjAlM0QlMjBmYWxzZQ==",highlighted:`<span class="hljs-section">[server]</span>
<span class="hljs-attr">enableXsrfProtection</span> = <span class="hljs-literal">false</span>`,wrap:!1}}),m=new me({props:{$$slots:{default:[fe]},$$scope:{ctx:I}}}),{c(){n=l("meta"),c=o(),h=l("p"),W=o(),H(u.$$.fragment),Z=o(),d=l("p"),d.innerHTML=N,E=o(),H($.$$.fragment),Y=o(),g=l("p"),g.innerHTML=O,A=o(),w=l("p"),w.innerHTML=G,J=o(),p=l("ol"),_=l("li"),v=l("p"),v.textContent=U,z=o(),H(y.$$.fragment),Q=o(),S=l("li"),T=l("p"),T.innerHTML=ee,q=o(),H(b.$$.fragment),K=o(),H(m.$$.fragment),R=o(),x=l("p"),this.h()},l(e){const t=re("svelte-u9bgzb",document.head);n=r(t,"META",{name:!0,content:!0}),t.forEach(a),c=s(e),h=r(e,"P",{}),C(h).forEach(a),W=s(e),L(u.$$.fragment,e),Z=s(e),d=r(e,"P",{"data-svelte-h":!0}),M(d)!=="svelte-1domup1"&&(d.innerHTML=N),E=s(e),L($.$$.fragment,e),Y=s(e),g=r(e,"P",{"data-svelte-h":!0}),M(g)!=="svelte-ulqtw2"&&(g.innerHTML=O),A=s(e),w=r(e,"P",{"data-svelte-h":!0}),M(w)!=="svelte-rjiuoj"&&(w.innerHTML=G),J=s(e),p=r(e,"OL",{});var k=C(p);_=r(k,"LI",{});var F=C(_);v=r(F,"P",{"data-svelte-h":!0}),M(v)!=="svelte-1h01oe1"&&(v.textContent=U),z=s(F),L(y.$$.fragment,F),F.forEach(a),Q=s(k),S=r(k,"LI",{});var V=C(S);T=r(V,"P",{"data-svelte-h":!0}),M(T)!=="svelte-1tebkxx"&&(T.innerHTML=ee),q=s(V),L(b.$$.fragment,V),V.forEach(a),k.forEach(a),K=s(e),L(m.$$.fragment,e),R=s(e),x=r(e,"P",{}),C(x).forEach(a),this.h()},h(){te(n,"name","hf:doc:metadata"),te(n,"content",ue)},m(e,t){f(document.head,n),i(e,c,t),i(e,h,t),i(e,W,t),P(u,e,t),i(e,Z,t),i(e,d,t),i(e,E,t),P($,e,t),i(e,Y,t),i(e,g,t),i(e,A,t),i(e,w,t),i(e,J,t),i(e,p,t),f(p,_),f(_,v),f(_,z),P(y,_,null),f(p,Q),f(p,S),f(S,T),f(S,q),P(b,S,null),i(e,K,t),P(m,e,t),i(e,R,t),i(e,x,t),X=!0},p(e,[t]){const k={};t&2&&(k.$$scope={dirty:t,ctx:e}),m.$set(k)},i(e){X||(B(u.$$.fragment,e),B($.$$.fragment,e),B(y.$$.fragment,e),B(b.$$.fragment,e),B(m.$$.fragment,e),X=!0)},o(e){D(u.$$.fragment,e),D($.$$.fragment,e),D(y.$$.fragment,e),D(b.$$.fragment,e),D(m.$$.fragment,e),X=!1},d(e){e&&(a(c),a(h),a(W),a(Z),a(d),a(E),a(Y),a(g),a(A),a(w),a(J),a(p),a(K),a(R),a(x)),a(n),j(u,e),j($,e),j(y),j(b),j(m,e)}}}const ue='{"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 de(I){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends se{constructor(n){super(),le(this,n,de,he,ne,{})}}export{Se as component};
