Issue re-routing Kubernetes deployed app

Issue re-routing Kubernetes deployed app

Hi, we’ve deployed our Streamlit app on our Kubernetes cluster with no problem: the app loads using the correct URL. Now we want to expose this app outside of our working environment, and for this we plan on using a router using the IHttpHandler class as such:

public void ProcessRequest (HttpContext context) {
        HttpRequest original = context.Request;

        string service = "our_url";

        HttpWebResponse fwResponse = ForwardRequest(context.Request, service);
        if (fwResponse.StatusCode == HttpStatusCode.OK) {
            Stream stream = fwResponse.GetResponseStream();
            context.Response.ContentType = fwResponse.ContentType;
            stream.CopyTo(context.Response.OutputStream);
            return;
        }
       
    }

    public HttpWebResponse ForwardRequest(HttpRequest request, string serviceUri) {
        HttpWebRequest fwRequest = (HttpWebRequest)WebRequest.Create(serviceUri);

        fwRequest.ContentType = request.ContentType;
        fwRequest.Method = request.HttpMethod;
        fwRequest.UserAgent = request.UserAgent;

        if (request.HttpMethod != "GET"
                && request.HttpMethod != "HEAD"
                && request.ContentLength > 0)
        {
            Stream fwStream = fwRequest.GetRequestStream();
            request.InputStream.CopyTo(fwStream);
            fwStream.Close();
        }

        return (HttpWebResponse)fwRequest.GetResponse();
    }

Now the issue is that we correctly get the base HTML file for the page but we get an error 404 for the .js and .css files we need to fully render the page (see below).

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.