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