Commit d3205be1 authored by jan.koester's avatar jan.koester
Browse files

test

parent fa2ca8e5
Loading
Loading
Loading
Loading
+10 −2
Changes for src/http/HttpProxyServer.cpp: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -204,10 +204,18 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int
            upstreamBase = matched.upstream;
        }

        // The route matches on pathPrefix (e.g. "/bolli"), but the backend is mounted
        // at "/" and knows nothing about that prefix -- forward the remainder only.
        std::string forwardPath = url.substr(matched.pathPrefix.size());
        if (forwardPath.empty() || forwardPath[0] != '/') forwardPath = "/" + forwardPath;

        bool upstreamOk = false;
        try {
            libhttppp::HttpUrl upstream(upstreamBase + url);
            libhttppp::HttpClient client(upstream);
            libhttppp::HttpUrl upstream(upstreamBase + forwardPath);
            // vers=3: try HTTP/3 first, falling back to HTTP/2 then HTTP/1.1 over
            // TLS (or straight to H1 for a cleartext upstream) -- see HttpClient
            // ctor in libhttppp/src/http.cpp for the fallback ladder.
            libhttppp::HttpClient client(upstream, /*vers=*/3);
            libhttppp::HttpRequest outreq;
            outreq.setRequestType(GETREQUEST);
            outreq.setRequestURL(upstream.getPath());