Bug #76567

"Error - reference to main window is not set properly" on NGINX when using deprecated entry point browser.php

Added by Juan Manuel Vergés Solanas over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-06-09
Due date:
% Done:

0%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello guys,

I propose 2 different solutions here, the easy one and the good one.

The easy one is modify https://typo3.org/typo3-cms/overview/requirements/ and put a bold note telling 7LTS is not working with Nginx, or better say only code without deprecation will work with 7LTS and Nginx (yeah)

The good one could be to deliver a Nginx config.

As far as I could get:

browser.php is not there since https://github.com/TYPO3/TYPO3.CMS/commit/f00efef1bd93181fe1c594bf169cd8ccb6eb7f63

when you use nginx, once you apply:

```
location ~* ^(?<bpath>.*/)(ajax|alt_clickmenu|alt_db_navframe|alt_doc|alt_file_navframe|browser|db_new|dummy|init|login_frameset|logout|mod|move_el|show_item|tce_db|tce_file|thumbs)\.php$ {
include fastcgi_params;
fastcgi_param TYPO3_CONTEXT Development;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm-vagrant.socket; #take care of your socket here
fastcgi_read_timeout 600;
fastcgi_param SCRIPT_FILENAME $document_root${bpath}deprecated.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}

```

or this:
`
rewrite ^(.*/)(ajax|alt_clickmenu|alt_db_navframe|alt_doc|alt_file_navframe|browser|db_new|dummy|init|login_frameset|logout|mod|move_el|show_item|tce_db|tce_file|thumbs)\.php$ $1deprecated.php$is_args$args last;

`

in nginx the browser.php window appears again.

However, once you select the file you want, a prompt is displayed saying:

![image](https://cloud.githubusercontent.com/assets/2902073/15923110/9ac01ad0-2e2b-11e6-98bb-34976730a687.png)

Error - reference to main window is not set properly!

I can confirm the following:
-Apache .htaccess is working and window.opener is not lost, so works properly.
-Nginx conf I delivered is half working as the browser.php window is shown but window.opener (or something) is lost there.
The first one image is Nginx the second one is Apache, they look equal. both TYPO3 7.6.9 only apache is working:

![image](https://cloud.githubusercontent.com/assets/2902073/15927315/311cb5aa-2e41-11e6-8d6f-23a5a26bb401.png)

Nginx is telling me:
![image](https://cloud.githubusercontent.com/assets/2902073/15927354/79e4d9ca-2e41-11e6-8f58-1edfd16400ad.png)

This line (at least in javascript, at least at this point): https://github.com/TYPO3/TYPO3.CMS/blob/6706d3853224097e752b0cb3e1a5c001e9e8f157/typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js#L186
is the one is having a difference between both Nginx and Apache

Any thoughts and feedback is as welcomed as always.

Affected community repos by this probably: https://github.com/webdevops/TYPO3-docker-boilerplate , https://github.com/FluidTYPO3/FluidTYPO3-Vagrant , https://github.com/Tuurlijk/TYPO3.Homestead ( I can confirm the first two )

I hope any of you find useful all this info.

Best wishes,
Juan Manuel.


Related issues

Related to TYPO3 Core - Task #54316: Provide a Nginx server configuration New 2013-12-11

History

#1 Updated by Mathias Schreiber over 3 years ago

  • Status changed from New to Needs Feedback

Can you supply an extension that uses the old entrypoints?

#2 Updated by Markus Blaschke over 3 years ago

Would it be possible to recreate the files (eg. with redirect or something like that), mark them as deprecated and push this fix to TYPO3 7 LTS?
It's fine to remove them for 8.x but it would be nice to keep some deprecated stuff without configuration workarounds for TYPO3 7.6 :)

#4 Updated by Juan Manuel Vergés Solanas over 3 years ago

I only know about https://github.com/FluidTYPO3/flux but I bet a round of beers there are more in the TER ;)

#5 Updated by Stephan Großberndt over 3 years ago

  • Subject changed from Nginx hell? to "Error - reference to main window is not set properly" on NGINX when using deprecated entry point browser.php

#6 Updated by Stephan Großberndt over 3 years ago

@jmverges Please add a description on how to trigger that problem with an extension

#7 Updated by Juan Manuel Vergés Solanas over 3 years ago

Hi there, sorry for the late response.

  • Install the extension https://github.com/jmverges/nginx_test and put the provided typoscript template in your root template; one time in apache and other time in nginx
  • Put the content element deliver as example: (Tab Nginx)
  • click on property File
  • A popup is shown in apache
  • A popup is shown in nginx if you apply the readme.
  • Click on a file from file admin in apache:
  • All is good
  • Click on a file from file admin in nginx:
  • Javascript prompt with error is shown

#8 Updated by Claus Due over 3 years ago

I've tested every way I know how, using the `nginx_test` extension Juan provided, on apache and nginx with no special URL rewriting on either of those. On both sites the expected `index.php?route=....` URL is opened when I click the "browse for file" icon and regardless of the way I select a file (upload then select, upload first then select in separate operation, select and click "import selection", place file in root folder - all with the same positive result). I managed to break the JS a single time in a new record before saving, but the symptom was that I couldn't clear the file again - I could select and browse for files still. I've done all this while using Charles HTTP proxy to detect if any redirects, permanent or otherwise, were in play (and I did it on a never before visited hostname). All of it checks out.

I'm very sorry to say, Juan, that I just can't reproduce this behavior at all. I've searched every piece of code that loads when the required set of extensions are installed and not a single one of them contains any references to `browser.php` (or the other deprecated endpoints). I've confirmed that indeed, Flux delivers TCA for this field and this TCA is as expected. I include a sample below:

array(17) { ["type"]=> string(5) "group" ["transform"]=> NULL ["default"]=> NULL ["size"]=> int(1) ["maxitems"]=> string(1) "1" ["minitems"]=> int(0) ["multiple"]=> bool(false) ["renderMode"]=> NULL ["itemListStyle"]=> NULL ["selectedListStyle"]=> NULL ["renderType"]=> NULL ["disallowed"]=> NULL ["allowed"]=> NULL ["max_size"]=> NULL ["uploadfolder"]=> NULL ["show_thumbs"]=> bool(true) ["internal_type"]=> string(4) "file" }

Do you have any idea about or can you track down the reason why this component on your site tries to open `browser.php`?

#9 Updated by Juan Manuel Vergés Solanas over 3 years ago

Deprecated code is in ext:vidi or ext:media I just saw I have them installed on the system. I will update the test extension.

#10 Updated by Juan Manuel Vergés Solanas over 3 years ago

I didn't perceive I had ext:media and ext:vidi installed. If I uninstall it flux works again, so deprecated code is not in flux is in ext:media or ext:vidi.

#11 Updated by Juan Manuel Vergés Solanas over 3 years ago

This chekout needs to be enable so the problem is isolated there: http://prntscr.com/bh7zgj

#12 Updated by Morton Jonuschat over 3 years ago

  • Status changed from Needs Feedback to Closed

Closing this as the bug is caused by EXT:media. Regarding the NGINX configuration there's already an issue open for that, I've linked these two for reference.

Also available in: Atom PDF