Skip to content

Commit e3950cf

Browse files
committed
do not use prerender for head and content type requests
1 parent 38eaf1b commit e3950cf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/utils.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function prepareRequestOptions(request_options, options) {
9595

9696
var proxy = (options && options.proxy) || getCustomProxyForUri(uri, options);
9797
if (proxy) {
98-
if (proxy.prerender && CONFIG.PRERENDER_URL) {
98+
if (proxy.prerender && CONFIG.PRERENDER_URL && !options?.prevent_prerender) {
9999
request_options.uri = CONFIG.PRERENDER_URL + encodeURIComponent(uri);
100100

101101
} else if (proxy.proxy && CONFIG.PROXY_URL) {
@@ -278,7 +278,10 @@ var getHead = function(url, options, callbacks) {
278278
redirect: redirect,
279279
follow: follow
280280
// No abort controller for head.
281-
}, options);
281+
}, {
282+
...options,
283+
prevent_prerender: true
284+
});
282285

283286
try {
284287
fetchStreamAuthorized(request_options)
@@ -626,6 +629,7 @@ export function findMainLdObjectWithVideo(ld) {
626629
}
627630

628631
getUrlFunctional(uri, {
632+
prevent_prerender: true,
629633
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT,
630634
asBuffer: true
631635
}, {
@@ -815,7 +819,8 @@ export function getContentType(uriForCache, uriOriginal, options, cb) {
815819
var methodCaller = method && method === 'GET' ? getUrlFunctional : getHeadFunctional;
816820

817821
methodCaller(uri, {
818-
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT
822+
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT,
823+
prevent_prerender: true
819824
}, {
820825
onResponse: function(res, request_options) {
821826

@@ -1230,7 +1235,9 @@ var getUriStatusPrivate = function(uri, options, cb) {
12301235
},
12311236
timeout: options.timeout || CONFIG.RESPONSE_TIMEOUT,
12321237
follow: CONFIG.MAX_REDIRECTS
1233-
})
1238+
}, {
1239+
prevent_prerender: true
1240+
});
12341241

12351242
try {
12361243
fetchStream(request_options)

0 commit comments

Comments
 (0)