Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JQuery, TinyMCE endless 301 redirects #216

Closed
mrclay opened this issue Sep 4, 2015 · 15 comments
Closed

JQuery, TinyMCE endless 301 redirects #216

mrclay opened this issue Sep 4, 2015 · 15 comments

Comments

@mrclay
Copy link
Owner

mrclay commented Sep 4, 2015

Originally reported on Google Code with ID 71

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

Reported by popec82 on 2008-11-26 12:01:28

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

This sounds like Issue 55. Check the workaround I just posted:

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

Reported by mrclay.org on 2008-11-26 14:42:09

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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

Reported by popec82 on 2008-11-26 14:57:47

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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.

Reported by mrclay.org on 2008-11-26 16:09:11

  • Status changed: NeedInfo
  • Merged into: #-55

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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

Reported by popec82 on 2008-11-26 16:45:07

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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

Reported by popec82 on 2008-11-26 16:48:53

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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.

Reported by mrclay.org on 2008-11-26 18:58:35

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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

Reported by popec82 on 2008-11-26 19:18:26

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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)

Reported by grEvenX on 2009-01-05 15:43:34

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

@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).

Reported by mrclay.org on 2009-01-05 16:05:42

  • Labels added: Priority-Low
  • Labels removed: Priority-Medium

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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

Reported by mrclay.org on 2009-01-26 18:49:04

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

Never confirmed redirects caused by Minify

Reported by mrclay.org on 2009-06-30 16:37:55

  • Status changed: WontFix

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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,modele/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/script/js/jquery/i18n/jquery.ui.datepicker-fr.js,modele/defaut/script/js/jquery/jquery-ui-1.8.15.custom.min.js,modele/defaut/script/js/jquery/jquery.colorbox.min.js,modele/defaut/script/js/jquery/jquery.blockUI.min.js,modele/defaut/script/js/page/commun.js,modele/defaut/script/js/jquery/jquery.placeholder.min.js

Reported by n.vincent.lbo on 2011-08-12 12:59:03

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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();
}

Reported by n.vincent.lbo on 2011-08-12 13:05:48

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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.

Reported by n.vincent.lbo on 2011-08-12 13:08:37

@mrclay
Copy link
Owner Author

mrclay commented Sep 4, 2015

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 ^^.

Reported by n.vincent.lbo on 2011-08-12 13:15:49

@mrclay mrclay closed this as completed Sep 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant