dom-examples icon indicating copy to clipboard operation
dom-examples copied to clipboard

SSE example does not work in Firefox.

Open timschofield opened this issue 7 years ago • 4 comments
trafficstars

I have set this example up on my localhost with nginx running (I have made the change from the Readme.md file) and it runs fine in Chromium but nothing happens in Firefox, no error messages just the button. I have tried it in v60 and the nightly build v62 with the same result.

Any ideas?

Tim

timschofield avatar Jun 17 '18 12:06 timschofield

Hrm, this is a bit of a worry. So you did make the fastcgi_buffering change.

I've not got nginx set up to test, but I just tried it again in the latest Firefox with Apache (via MAMP), and it worked fine.

chrisdavidmills avatar Jun 20 '18 09:06 chrisdavidmills

Ok. This is the relevant section from my config file:

location ~ \.php$ {
	include snippets/fastcgi-php.conf;

	# With php7.0-cgi alone:
	# fastcgi_pass 127.0.0.1:9000;
	# With php7.0-fpm:
	fastcgi_pass unix:/run/php/php7.0-fpm.sock;
	fastcgi_read_timeout 3000;
	fastcgi_buffering off;
}

this is the snippets file that is included by the above:

regex to split $uri to $fastcgi_script_name and $fastcgi_path

fastcgi_split_path_info ^(.+.php)(/.+)$;

Check that the PHP script exists before passing it

try_files $fastcgi_script_name =404;

Bypass the fact that try_files resets $fastcgi_path_info

see: http://trac.nginx.org/nginx/ticket/321

set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php; include fastcgi.conf;

I tried in Opera as well as Chromium and they both worked. I will have a go at setting up an apache server and see if I can narrow it down.

timschofield avatar Jun 20 '18 10:06 timschofield

Firefox issue for me as well. But in my case it asks to download the PHP file instead. Works in Chrome. I'm able to able other php files in all browsers

PHP 7.2.24-0ubuntu0.18.04.10 (cli) (built: Oct 25 2021 17:47:59) ( NTS ) Server version: Apache/2.4.29 (Ubuntu)

jaesoni avatar Nov 16 '21 09:11 jaesoni

Link to the code file: https://github.com/mdn/dom-examples/blob/main/server-sent-events/sse.php

dipikabh avatar Nov 03 '23 14:11 dipikabh

Thanks a lot for reporting this one. I can confirm this works as expected on Nightly and stable Fx releases:

  • Firefox Nightly 126.0a1 (2024-03-25) (64-bit)
  • Firefox 124.0.1 (64 bit)

image

steps to reproduce:

git clone https://github.com/mdn/dom-examples.git
cd dom-examples/server-sent-events
php -S localhost:8000

For nginx config, this has been fixed in https://github.com/mdn/dom-examples/pull/91

I'm going to close as fixed, but if you think I've missed something, feel free to reply and let me know!

bsmth avatar Apr 05 '24 16:04 bsmth