File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -301,23 +301,17 @@ module.exports = function (express, config) {
301301 proxyUrlDownload ( req , res , url ) ;
302302 }
303303
304- const PROXY_REDIRECT_WHITELIST = [
305- 'https://www.spigotmc.org/resources/' ,
306- 'https://github.com/' ,
307- 'https://objects.githubusercontent.com/'
308- ]
309-
310304 function proxyUrlDownload ( req , res , url , r = 4 ) {
311305 console . log ( "proxying download for " + url )
312306 https . get ( url , {
313307 headers : {
314308 'User-Agent' : config . userAgent
315309 }
316310 } , resp => {
317- if ( r > 0 && ( resp . statusCode === 301 || resp . statusCode === 302 || resp . statusCode === 307 ) && PROXY_REDIRECT_WHITELIST . some ( w => resp . headers . location . startsWith ( w ) ) ) {
318- res . set ( 'X-Spiget-Redirect-' + r , resp . headers . location ) ;
311+ if ( resp . statusCode === 301 || resp . statusCode === 302 || resp . statusCode === 307 ) {
319312 console . log ( "redirecting to " + resp . headers . location ) ;
320- proxyUrlDownload ( req , res , resp . headers . location , r - 1 ) ;
313+ res . set ( 'Location' , resp . headers . location ) ;
314+ res . status ( 307 ) . end ( ) ;
321315 return ;
322316 }
323317 console . log ( resp . statusCode + " " + url ) ;
You can’t perform that action at this time.
0 commit comments