Jeff-Lewis / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

JQuery, TinyMCE endless 301 redirects #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.1.1
PHP version: 5.2.6
jQuery 1.2.6-min.js
tinyMCE 3.2.1

What steps will reproduce the problem?
1. /min?f=js/jquery.js,js/tiny_mce/tiny_mce.js,js/init.js&debug=1
2. in init.js i have tinyMCE.init({ ... standard methods to initiate TinMCE
... });

Expected output: correct one

Actual output: JS ERROR (Firebug output):
missing ; before statement
[Break on this error] /* 28 *|
xhr.open(type,s.url,s.async);tr...[s.url]=modRes;if(!jsonp)success();}else

Did you run the unit tests? Did any FAIL? All went OK

Please provide any additional information below.
Sometimes 301 Moved permamently repeats with this request and never stops
making browser to hang and request never ends

Original issue reported on code.google.com by pope...@gmail.com on 26 Nov 2008 at 12:01

GoogleCodeExporter commented 9 years ago
This sounds like Issue 55. Check the workaround I just posted:

http://code.google.com/p/minify/issues/detail?id=55#c5

Original comment by mrclay....@gmail.com on 26 Nov 2008 at 2:42

GoogleCodeExporter commented 9 years ago
Changing $source->minifier = array('Minify_Lines', 'minify'); to 
$source->minifier =
'trim'; solved problems with JS Errors but not with 301 Moved Permamently.

This 301 appears when I use tinyMCE.init({ ... }); method of TinyMCE editor. 
Without
this code it works fine but I can't initiate TinyMCE editor

Original comment by pope...@gmail.com on 26 Nov 2008 at 2:57

GoogleCodeExporter commented 9 years ago
Could you use an HTTP analyzer like Fiddler to see what URLs are sending the 
redirects? The only redirect code in minify redirects to the root "/" of a site.

Original comment by mrclay....@gmail.com on 26 Nov 2008 at 4:09

GoogleCodeExporter commented 9 years ago
http://domain/min?f=/js/jquery.js,/js/tiny_mce/tiny_mce.js,/js/forms.js

GET /min?f=/js/jquery.js,/js/tiny_mce/tiny_mce.js,/js/forms.js HTTP/1.1
Host: domain
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; pl; rv:1.9.0.4) 
Gecko/2008102920
Firefox/3.0.4
Accept: */*
Accept-Language: en,en-us;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://domain/test
Cookie: PHPSESSID=db42c9f88aea9804cafbc825d866d70b
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.x 301 Moved Permanently
Date: Wed, 26 Nov 2008 16:39:30 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.3
Location: 
http://domain/min/?f=/js/jquery.js,/js/tiny_mce/tiny_mce.js,/js/forms.js
Content-Length: 398
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

Original comment by pope...@gmail.com on 26 Nov 2008 at 4:45

GoogleCodeExporter commented 9 years ago
After writing it as follows
http://domain/min/?f=/js/jquery.js,/js/tiny_mce/tiny_mce.js,/js/forms.js 301
Redirection disappears but browser still tries to load those url infinite 
number of times

Original comment by pope...@gmail.com on 26 Nov 2008 at 4:48

GoogleCodeExporter commented 9 years ago
The beginning of your new URI is correct: /min/?f=... (not /min?f=...)
but it should be:
http://domain/min/?f=js/jquery.js,js/tiny_mce/tiny_mce.js,js/forms.js
(no root slashes). See if that doesn't help, but again, there's no code path 
I'm 
aware of in Minify that redirects to the same URL. Maybe the JS library is 
resending 
the request. If you still have trouble, email me or join the google group.

Original comment by mrclay....@gmail.com on 26 Nov 2008 at 6:58

GoogleCodeExporter commented 9 years ago
It still didn't help. If you have some time i would be the best to try Minify 
with
jQuery, TinyMCE and some basic JS Script that initiates tinyMCE

Original comment by pope...@gmail.com on 26 Nov 2008 at 7:18

GoogleCodeExporter commented 9 years ago
I've run into the same issue.
The problem is when using debug mode.
E.g. in jQuery one line of the source reads:
s.accepts[ s.dataType ] + ", */*" :

Minify think that this is a comment for the JavaScript, and starts the line 
with:
/* 2717 *| s.accepts[ s.dataType ] + ", */*" :

The correct output in this case should be
/* 2717 */ s.accepts[ s.dataType ] + ", */*" :

(slash instead of pipe)

Original comment by grEv...@gmail.com on 5 Jan 2009 at 3:43

GoogleCodeExporter commented 9 years ago
@grEvenX: I believe your problem is Issue 55 (should be fixed in R275). Replace 
Lines.php with that file in R275.

I'm leaving this issue open for the 301 redirect problem popec82 was having 
(though 
I'm not convinced Minify is causing this).

Original comment by mrclay....@gmail.com on 5 Jan 2009 at 4:05

GoogleCodeExporter commented 9 years ago
Anyone still having trouble with this issue should try this beta release:
http://groups.google.com/group/minify/browse_thread/thread/8add5761eb27d67d

Original comment by mrclay....@gmail.com on 26 Jan 2009 at 6:49

GoogleCodeExporter commented 9 years ago
Never confirmed redirects caused by Minify

Original comment by mrclay....@gmail.com on 30 Jun 2009 at 4:37

GoogleCodeExporter commented 9 years ago
I just run into this issue too.
In my page I use min for css and JS. Just the JS one give me a 301 redirect.
Calling it as : 
http://domain/autonome/min/?f=modele/defaut/script/js/page/traductions.FR.js,mod
ele/defaut/script/js/page/fonction.js,modele/defaut/script/js/jquery/jquery-1.6.
2.min.js,modele/defaut/script/js/jquery/i18n/jquery-ui-i18n.js,modele/defaut/scr
ipt/js/jquery/i18n/jquery.ui.datepicker-fr.js,modele/defaut/script/js/jquery/jqu
ery-ui-1.8.15.custom.min.js,modele/defaut/script/js/jquery/jquery.colorbox.min.j
s,modele/defaut/script/js/jquery/jquery.blockUI.min.js,modele/defaut/script/js/p
age/commun.js,modele/defaut/script/js/jquery/jquery.placeholder.min.js

Original comment by n.vincen...@gmail.com on 12 Aug 2011 at 12:59

GoogleCodeExporter commented 9 years ago
It seems to come from the fact the f parameter isn't read.
That's in this code the wrong thing happens (the last redirect) :

// check for URI versioning
if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
    $min_serveOptions['maxAge'] = 31536000;
}
if (isset($_GET['g'])) {
    // well need groups config
    $min_serveOptions['minApp']['groups'] = (require MINIFY_MIN_DIR . '/groupsConfig.php');
}
if (isset($_GET['f']) || isset($_GET['g'])) {
    // serve!   
    Minify::serve('MinApp', $min_serveOptions);

} elseif ($min_enableBuilder) {
    header('Location: builder/');
    exit();
} else {
die('test2 - '.print_r($_GET,true));
    header("Location: /");
    exit();
}

Original comment by n.vincen...@gmail.com on 12 Aug 2011 at 1:05

GoogleCodeExporter commented 9 years ago
It is probably not a minify issue, because doing a die(print_r($_GET,true)); at 
the start of index.php I can't catch the f parameter anymore. Trying to add 
remove other parameter I could catch each of its, but never the f one. So it 
should be because of the content of the f parameters.

Original comment by n.vincen...@gmail.com on 12 Aug 2011 at 1:08

GoogleCodeExporter commented 9 years ago
OK, so it seems that if the parmaeter is more the 512 characters (in my case) 
it just doesn't catch the parameters. So I have to work with group ^^.

Original comment by n.vincen...@gmail.com on 12 Aug 2011 at 1:15