diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 40ab9dea0..c985d5910 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -413,17 +413,18 @@ FW_Read($$) my @origin = grep /Origin/i, @FW_httpheader; $FW_headerlines = (AttrVal($FW_wname, "CORS", 0) ? (($#origin<0) ? "": "Access-Control-Allow-".$origin[0]."\r\n"). - "Access-Control-Allow-Methods: GET OPTIONS\r\n". + "Access-Control-Allow-Methods: GET POST OPTIONS\r\n". "Access-Control-Allow-Headers: Origin, Authorization, Accept\r\n". "Access-Control-Allow-Credentials: true\r\n". "Access-Control-Max-Age:86400\r\n" : ""); - ############################# - # Handle OPTIONS Request. Just reeturn headers and don't process any further. + ######################### + # Return 200 for OPTIONS or 405 for unsupported method my ($method, $arg, $httpvers) = split(" ", $FW_httpheader[0], 3); if($method !~ m/^(GET|POST)$/i){ + my $retCode = ($method eq "OPTIONS") ? 200 : 405; TcpServer_WriteBlocking($FW_chash, - "HTTP/1.1 200 OK\r\n" . + "HTTP/1.1 $retCode OK\r\n" . $FW_headerlines. "Content-Length: 0\r\n\r\n"); delete $hash->{CONTENT_LENGTH}; @@ -1566,7 +1567,7 @@ FW_roomOverview($) if($l1 eq "Save config") { $l1 .= ' ?'; + (int(@structChangeHist) ? 'visible' : 'hidden').'">?'; } # Force external browser if FHEMWEB is installed as an offline app. diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index ed64144d2..f877e6961 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -879,6 +879,7 @@ FW_longpoll() } else { FW_pollConn = new XMLHttpRequest(); FW_pollConn.open("GET", location.pathname+query, true); + FW_pollConn.overrideMimeType("application/json"); FW_pollConn.onreadystatechange = FW_doUpdate; FW_pollConn.send(null);