@@ -48,7 +48,7 @@ public function __construct(
4848 parent ::__construct (Application::APP_ID , $ request );
4949 }
5050
51- private function createProxyResponse (string $ path , IResponse $ response , $ cache = true ): ProxyResponse {
51+ private function createProxyResponse (string $ path , IResponse $ response , bool $ isHTML , $ cache = true ): ProxyResponse {
5252 $ headersToIgnore = ['aa-version ' , 'ex-app-id ' , 'authorization-app-api ' , 'ex-app-version ' , 'aa-request-id ' ];
5353 $ responseHeaders = [];
5454 foreach ($ response ->getHeaders () as $ key => $ value ) {
@@ -58,7 +58,6 @@ private function createProxyResponse(string $path, IResponse $response, $cache =
5858 }
5959 $ content = $ response ->getBody ();
6060
61- $ isHTML = pathinfo ($ path , PATHINFO_EXTENSION ) === 'html ' ;
6261 if ($ isHTML ) {
6362 $ nonce = $ this ->nonceManager ->getNonce ();
6463 $ content = str_replace (
@@ -98,9 +97,11 @@ public function ExAppGet(string $appId, string $other): Response {
9897 if ($ exApp === null ) {
9998 return new NotFoundResponse ();
10099 }
100+ $ isHTML = pathinfo ($ other , PATHINFO_EXTENSION ) === 'html ' ;
101101
102102 $ response = $ this ->service ->requestToExApp2 (
103103 $ exApp , '/ ' . $ other , $ this ->userId , 'GET ' , queryParams: $ _GET , options: [
104+ 'stream ' => !$ isHTML , // Can't stream HTML
104105 RequestOptions::COOKIES => $ this ->buildProxyCookiesJar ($ _COOKIE , $ this ->service ->getExAppDomain ($ exApp )),
105106 RequestOptions::HEADERS => $ this ->buildHeadersWithExclude ($ route , getallheaders ()),
106107 RequestOptions::TIMEOUT => 0 ,
@@ -112,7 +113,7 @@ public function ExAppGet(string $appId, string $other): Response {
112113 }
113114
114115 $ this ->processBruteforce ($ bruteforceProtection , $ delay , $ response ->getStatusCode ());
115- return $ this ->createProxyResponse ($ other , $ response );
116+ return $ this ->createProxyResponse ($ other , $ response, $ isHTML );
116117 }
117118
118119 #[PublicPage]
@@ -126,8 +127,10 @@ public function ExAppPost(string $appId, string $other): Response {
126127 if ($ exApp === null ) {
127128 return new NotFoundResponse ();
128129 }
130+ $ isHTML = pathinfo ($ other , PATHINFO_EXTENSION ) === 'html ' ;
129131
130132 $ options = [
133+ 'stream ' => !$ isHTML ,
131134 RequestOptions::COOKIES => $ this ->buildProxyCookiesJar ($ _COOKIE , $ this ->service ->getExAppDomain ($ exApp )),
132135 RequestOptions::HEADERS => $ this ->buildHeadersWithExclude ($ route , getallheaders ()),
133136 RequestOptions::TIMEOUT => 0 ,
@@ -153,7 +156,7 @@ public function ExAppPost(string $appId, string $other): Response {
153156 }
154157
155158 $ this ->processBruteforce ($ bruteforceProtection , $ delay , $ response ->getStatusCode ());
156- return $ this ->createProxyResponse ($ other , $ response );
159+ return $ this ->createProxyResponse ($ other , $ response, $ isHTML );
157160 }
158161
159162 #[PublicPage]
@@ -167,9 +170,11 @@ public function ExAppPut(string $appId, string $other): Response {
167170 if ($ exApp === null ) {
168171 return new NotFoundResponse ();
169172 }
173+ $ isHTML = pathinfo ($ other , PATHINFO_EXTENSION ) === 'html ' ;
170174
171175 $ stream = fopen ('php://input ' , 'r ' );
172176 $ options = [
177+ 'stream ' => !$ isHTML ,
173178 RequestOptions::COOKIES => $ this ->buildProxyCookiesJar ($ _COOKIE , $ this ->service ->getExAppDomain ($ exApp )),
174179 RequestOptions::BODY => $ stream ,
175180 RequestOptions::HEADERS => $ this ->buildHeadersWithExclude ($ route , getallheaders ()),
@@ -185,7 +190,7 @@ public function ExAppPut(string $appId, string $other): Response {
185190 }
186191
187192 $ this ->processBruteforce ($ bruteforceProtection , $ delay , $ response ->getStatusCode ());
188- return $ this ->createProxyResponse ($ other , $ response );
193+ return $ this ->createProxyResponse ($ other , $ response, $ isHTML );
189194 }
190195
191196 #[PublicPage]
@@ -199,9 +204,11 @@ public function ExAppDelete(string $appId, string $other): Response {
199204 if ($ exApp === null ) {
200205 return new NotFoundResponse ();
201206 }
207+ $ isHTML = pathinfo ($ other , PATHINFO_EXTENSION ) === 'html ' ;
202208
203209 $ stream = fopen ('php://input ' , 'r ' );
204210 $ options = [
211+ 'stream ' => !$ isHTML ,
205212 RequestOptions::COOKIES => $ this ->buildProxyCookiesJar ($ _COOKIE , $ this ->service ->getExAppDomain ($ exApp )),
206213 RequestOptions::BODY => $ stream ,
207214 RequestOptions::HEADERS => $ this ->buildHeadersWithExclude ($ route , getallheaders ()),
@@ -217,7 +224,7 @@ public function ExAppDelete(string $appId, string $other): Response {
217224 }
218225
219226 $ this ->processBruteforce ($ bruteforceProtection , $ delay , $ response ->getStatusCode ());
220- return $ this ->createProxyResponse ($ other , $ response );
227+ return $ this ->createProxyResponse ($ other , $ response, $ isHTML );
221228 }
222229
223230 private function prepareProxy (
0 commit comments