X
Tap here to go to the mobile version of the site.

Support Forum

FireFox renders html page on port 80, but lists html on port 8080.

Posted

I am working on a WiFi controlled relay that is controlled by a webserver. The server sends HTML code. Everything works in FireFox as long as the port is 80. When I change the port to 8080, FireFox lists the HTML code, but doesn't render it. Internet Explorer displays the webpage correctly for port 80 and 8080. I have the HTML 5 header as the 1st line. Placing "http://" in front of the IP doesn't help.

I am working on a WiFi controlled relay that is controlled by a webserver. The server sends HTML code. Everything works in FireFox as long as the port is 80. When I change the port to 8080, FireFox lists the HTML code, but doesn't render it. Internet Explorer displays the webpage correctly for port 80 and 8080. I have the HTML 5 header <!DOCTYPE html> as the 1st line. Placing "http://" in front of the IP doesn't help.

Chosen solution

Hi Jscher2000, Amazingly, that solved the problem!! FireFox now displays the webpage on port 9000. It still is a mystery why it always worked on port 80, but was "picky" on the other ports. The last few days were certainly frustrating at times. Anyway, thanks a lot for your help. JimK

Read this answer in context 0

Additional System Details

Installed Plug-ins

  • Shockwave Flash 28.0 r0

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0

More Information

cor-el
  • Top 10 Contributor
  • Moderator
17568 solutions 158896 answers

Did you check the HTTP response headers in the Network Monitor and possibly in "Page Info -> General" to make sure that the file is send as text/html ?

Did you check the HTTP response headers in the Network Monitor and possibly in "Page Info -> General" to make sure that the file is send as text/html ? *https://developer.mozilla.org/en/Tools/Network_Monitor

Question owner

Hi, Internet Explorer Displays the page correctly, FireFox does not. The web server sends the same text whether it goes out port 80 or port 8080. or to IE or FireFox. It does not know the difference. If it works in one case, it should work for all cases.

Hi, Internet Explorer Displays the page correctly, FireFox does not. The web server sends the same text whether it goes out port 80 or port 8080. or to IE or FireFox. It does not know the difference. If it works in one case, it should work for all cases.
AnnaSycamore 8 solutions 95 answers

Hello, The first question: It's your FF -up-to-date? You have https on port 8080? Firefox alert you that block some content on this page? Click on the shield icon in address bar and verify. On the other side:

Press Ctrl+Shift+ K to open the Console Log

Are the alerts or errors there? See screenshots Any help?

Hello, The first question: It's your FF -up-to-date? You have https on port 8080? Firefox alert you that block some content on this page? Click on the shield icon in address bar and verify. On the other side: Press Ctrl+Shift+ K to open the Console Log Are the alerts or errors there? See screenshots Any help?

Modified by AnnaSycamore

Question owner

OK, it's complaining about the character encoding. There appears to be a couple of lines in the text declaring english us windows char set. What "magic phrase" does FireFox want? And where to put it in the text?

OK, it's complaining about the character encoding. There appears to be a couple of lines in the text declaring english us windows char set. What "magic phrase" does FireFox want? And where to put it in the text?
jscher2000
  • Top 10 Contributor
8785 solutions 71851 answers

Hi Jim44685, the problem there is the "plain text document" part.

You want Firefox to interpret the file as HTML, not plain text. IE has a developer crutch: it sniffs file content and overrides the content-type header in some cases. Firefox doesn't do that.

Your web server normally associates a content type of text/html with web pages based on extension (e.g., index.html, index.htm, default.html, default.htm, all served with a content-type of text/html). Or if you use PHP or another rendering engine, it will generate the correct content-type header.

What's odd is that your hosts on the different ports don't have the identical configuration when it comes to MIME types. Is that easy to find/compare in your web server settings?

Hi Jim44685, the problem there is the "plain text document" part. You want Firefox to interpret the file as HTML, not plain text. IE has a developer crutch: it sniffs file content and overrides the content-type header in some cases. Firefox doesn't do that. Your web server normally associates a content type of text/html with web pages based on extension (e.g., index.html, index.htm, default.html, default.htm, all served with a content-type of text/html). Or if you use PHP or another rendering engine, it will generate the correct content-type header. What's odd is that your hosts on the different ports don't have the identical configuration when it comes to MIME types. Is that easy to find/compare in your web server settings?

Modified by jscher2000

Question owner

The webserver sits at 192.168.0.175 and services port 80. FireFox renders the webpage on the local intranet. For internet access my router connects my external IP port 8080 to this internal server address. Therefore the server has no idea of the external port number. It's FireFox that's seeing the port changing from 80 to 8080 when I try to render the webpage externally. There has to be some setting in FireFox to allow webpages to be rendered from ports other than 80.

The webserver sits at 192.168.0.175 and services port 80. FireFox renders the webpage on the local intranet. For internet access my router connects my external IP port 8080 to this internal server address. Therefore the server has no idea of the external port number. It's FireFox that's seeing the port changing from 80 to 8080 when I try to render the webpage externally. There has to be some setting in FireFox to allow webpages to be rendered from ports other than 80.
jscher2000
  • Top 10 Contributor
8785 solutions 71851 answers

I think Firefox works the same way with port 80 and 8080. 8080 is not an unusual port for a web or proxy server.

When you access the page locally on port 80, is the server sending the text/html Content-Type header? cor-el provided a link earlier on how to check that using the Network Monitor (click the request and view Response Headers on the right side) or the Page Info dialog (on the General panel, the "Type").


If you don't get a solution here, you could submit a support ticket about the problem and see whether it's a known issue: https://www.noip.com/ticket/

I think Firefox works the same way with port 80 and 8080. 8080 is not an unusual port for a web or proxy server. When you access the page locally on port 80, is the server sending the text/html Content-Type header? cor-el provided a link earlier on how to check that using the Network Monitor (click the request and view Response Headers on the right side) or the Page Info dialog (on the General panel, the "Type"). ---- If you don't get a solution here, you could submit a support ticket about the problem and see whether it's a known issue: https://www.noip.com/ticket/
AnnaSycamore 8 solutions 95 answers

Hello ADD <meta charset="utf-8"> after your head declaration note the tags and the word meta Hope this help!

Hello '''ADD''' <meta charset="utf-8"> after your head declaration note the tags and the word meta Hope this help!

Modified by AnnaSycamore

AnnaSycamore 8 solutions 95 answers

Hello, I can't edit code there The page is from sitepoint https://www.sitepoint.com/a-basic-html5-template/ read the article carefully and put attention to the standard elements of the html page Hope this help

Hello, I can't edit code there The page is from sitepoint https://www.sitepoint.com/a-basic-html5-template/ read the article carefully and put attention to the standard elements of the html page Hope this help

Modified by AnnaSycamore

Question owner

OK, I've added the recommended header to identify the character encoding, still no luck. Any more ideas? The page still renders locally from the server port 80.

OK, I've added the recommended header to identify the character encoding, still no luck. Any more ideas? The page still renders locally from the server port 80.
AnnaSycamore 8 solutions 95 answers

Hello, Yes but you are on port 9000 See your image The ports are only numbers They can serve what you want if they are configured correctly for that. Some of them are considered default for specific tasks. The port 80 is a default http port for a web client. 8080 is a HTTP alternate port and the default HTTP for Apache TomCat


Hope this help

Hello, Yes but you are on port 9000 See your image The ports are only numbers They can serve what you want if they are configured correctly for that. Some of them are considered default for specific tasks. The port 80 is a default http port for a web client. 8080 is a HTTP alternate port and the default HTTP for Apache TomCat Hope this help

Modified by AnnaSycamore

jscher2000
  • Top 10 Contributor
8785 solutions 71851 answers

Somewhere between your web server, your router, and the redirect service, it seems that the "text/html" content type sent by the server is getting stripped or changed to "text/plain" instead. Firefox needs the text/html content-type header to render it as HTML. Earlier in this thread, we suggested ways to view the content-type header to confirm what your Firefox is receiving to see whether this is the problem (for example, using the Network Monitor tool). I don't know whether you ever did that.

Somewhere between your web server, your router, and the redirect service, it seems that the "text/html" content type sent by the server is getting stripped or changed to "text/plain" instead. Firefox needs the text/html content-type header to render it as HTML. Earlier in this thread, we suggested ways to view the content-type header to confirm what your Firefox is receiving to see whether this is the problem (for example, using the Network Monitor tool). I don't know whether you ever did that.

Question owner

OK, here is the current rundown. I switched relay webservers to 192.168.0.176:80 and port forwarded n8pxw.no-ip.org:9000 to it. I wanted to see if something was wrong with the server. I used the network monitor tool. On port 80 it said "HTML" on port 9000 "plain". Some one said maybe it's no-ip, so I tried my external ip, "91.xxx.xxx.71:9000. No luck, so it's not no-ip. OK, maybe the router is changing the type. I went thru the process on setting up another router from a different manufacturer, a PITA. Same results. Finally I changed the port on the webserver to 9000. So I connected my PC directly to the webserver, no router, and the network monitor said "plain". The webserver doesn't care what port it uses. After chasing my tail for 3 days, it has become clear that my original observation is correct "Firefox only renders web pages on port 80, by default". What I need is an authoritative answer, from a developer,programmer, or code maintainer, can this default be changed, or is firefox wedded to port 80, one of over 65,000 ports available?

OK, here is the current rundown. I switched relay webservers to 192.168.0.176:80 and port forwarded n8pxw.no-ip.org:9000 to it. I wanted to see if something was wrong with the server. I used the network monitor tool. On port 80 it said "HTML" on port 9000 "plain". Some one said maybe it's no-ip, so I tried my external ip, "91.xxx.xxx.71:9000. No luck, so it's not no-ip. OK, maybe the router is changing the type. I went thru the process on setting up another router from a different manufacturer, a PITA. Same results. Finally I changed the port on the webserver to 9000. So I connected my PC directly to the webserver, no router, and the network monitor said "plain". The webserver doesn't care what port it uses. After chasing my tail for 3 days, it has become clear that my original observation is correct "Firefox only renders web pages on port 80, by default". What I need is an authoritative answer, from a developer,programmer, or code maintainer, can this default be changed, or is firefox wedded to port 80, one of over 65,000 ports available?
AnnaSycamore 8 solutions 95 answers

What software are you running? IIS, Ngix, Lamp, Mamp, Wamp, NodeJS (express), Apache Tomcat? You need to configure your software to listen that port The default port are listed here: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

What software are you running? IIS, Ngix, Lamp, Mamp, Wamp, NodeJS (express), Apache Tomcat? You need to configure your software to listen that port The default port are listed here: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

Modified by AnnaSycamore

AnnaSycamore 8 solutions 95 answers

You need a port forwarding 91.xxx.xxx.71:80 to 91.xxx.xxx.71:80.80

You need a port forwarding 91.xxx.xxx.71:80 to 91.xxx.xxx.71:80.80

Modified by AnnaSycamore

jscher2000
  • Top 10 Contributor
8785 solutions 71851 answers

As far as I know, Firefox is not limited to ports 80 and 443. For example, the cPanel for my web hosting account is accessed on port 2083 and that works fine.

I found this interesting page to try nearly any port number you like. Do you get HTML from this site or only plain text?

http://portquiz.net:9000/

As far as I know, Firefox is not limited to ports 80 and 443. For example, the cPanel for my web hosting account is accessed on port 2083 and that works fine. I found this interesting page to try nearly any port number you like. Do you get HTML from this site or only plain text? http://portquiz.net:9000/

Question owner

I get HTML back from this site. It says my 9000 port is open and working. OK, I have a zinger for you. I set the webserver to 192.168.0.176:9000. Firefox says "plain" and only lists the HTML. Now, I use the router NAT port forwarding to map 192.168.0.176:9000 to n8pxw.no-ip.org:80. Guess what? The page renders in FireFox and it reports type "html".

I get HTML back from this site. It says my 9000 port is open and working. OK, I have a zinger for you. I set the webserver to 192.168.0.176:9000. Firefox says "plain" and only lists the HTML. Now, I use the router NAT port forwarding to map 192.168.0.176:9000 to n8pxw.no-ip.org:80. Guess what? The page renders in FireFox and it reports type "html".
jscher2000
  • Top 10 Contributor
8785 solutions 71851 answers

Are you checking the Content-Type header in the Network Monitor, or just Page Info? Please check the Content-type header for working and non-working ports.

Are you checking the Content-Type header in the Network Monitor, or just Page Info? Please check the Content-type header for working and non-working ports.

Question owner

I'm running EPS8266 environment, the script is in LUA.

--Small demo of internet/network controlled relay using ESP8266 (ESP-01) module and 2 channel optoisolated relay board

--Made by Sandeep Vaidya @ Robokits India - http://www.robokits.co.in for demo.

--Configure relay ouutput pins, pins are floating and relay opto needs ground to be activated. So pins are kept high on startup. Relay1 = 3 Relay2 = 4 gpio.mode(Relay1, gpio.OUTPUT) gpio.write(Relay1, gpio.HIGH); gpio.mode(Relay2, gpio.OUTPUT) gpio.write(Relay2, gpio.HIGH);

wifi.setmode(wifi.STATION) --Set network mode to station to connect it to wifi router. You can also set it to AP to make it a access point allowing connection from other wifi devices.

--Set a static ip so its easy to access cfg = {

   ip="192.168.0.176",
   netmask="255.255.255.0",
   gateway="192.168.0.1"
 }

wifi.sta.setip(cfg)

--Your router wifi network's SSID and password wifi.sta.config("TRENDnet","") --Automatically connect to network after disconnection wifi.sta.autoconnect(1) print ("\r\n") --Print network ip address on UART to confirm that network is connected print(wifi.sta.getip()) --Create server and send html data, process request from html for relay on/off. srv=net.createServer(net.TCP) srv:listen(9000,function(conn) --change port number if required. Provides flexibility when controlling through internet.

   conn:on("receive", function(client,request)
       local html_buffer = "";
       local html_buffer1 = "";


       local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
       if(method == nil)then
           _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
       end
       local _GET = {}
       if (vars ~= nil)then
           for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
               _GET[k] = v
           end
       end

html_buffer = html_buffer.."<meta charset="\"utf-8\"">"; html_buffer = html_buffer.."<title>Robokits IOT Server</title>

<marquee behavior="\"alternate\"" bgcolor="\"#FFFF00\"">ROBOKITS IOT SERVER </marquee>

"; html_buffer = html_buffer..""; html_buffer1 = html_buffer1..""; html_buffer1 = html_buffer1.."
"; html_buffer = html_buffer.."RELAY1RELAY2
<button>ON</button><button>ON</button>
<button>OFF</button><button>"; html_buffer1 = html_buffer1.."OFF</button>

Visit our website : http://www.robokits.co.in

";


       local _on,_off = "",""
       if(_GET.pin == "ON1")then
             gpio.write(Relay1, gpio.LOW);
       elseif(_GET.pin == "OFF1")then
             gpio.write(Relay1, gpio.HIGH);
       elseif(_GET.pin == "ON2")then
             gpio.write(Relay2, gpio.LOW);
       elseif(_GET.pin == "OFF2")then
             gpio.write(Relay2, gpio.HIGH);
       end
       --Buffer is sent in smaller chunks as due to limited memory ESP8266 cannot handle more than 1460 bytes of data.

client:send(html_buffer);

       client:send(html_buffer1);
       client:close();
       collectgarbage();
   end)

end)

I'm running EPS8266 environment, the script is in LUA. --Small demo of internet/network controlled relay using ESP8266 (ESP-01) module and 2 channel optoisolated relay board --Made by Sandeep Vaidya @ Robokits India - http://www.robokits.co.in for demo. --Configure relay ouutput pins, pins are floating and relay opto needs ground to be activated. So pins are kept high on startup. Relay1 = 3 Relay2 = 4 gpio.mode(Relay1, gpio.OUTPUT) gpio.write(Relay1, gpio.HIGH); gpio.mode(Relay2, gpio.OUTPUT) gpio.write(Relay2, gpio.HIGH); wifi.setmode(wifi.STATION) --Set network mode to station to connect it to wifi router. You can also set it to AP to make it a access point allowing connection from other wifi devices. --Set a static ip so its easy to access cfg = { ip="192.168.0.176", netmask="255.255.255.0", gateway="192.168.0.1" } wifi.sta.setip(cfg) --Your router wifi network's SSID and password wifi.sta.config("TRENDnet","") --Automatically connect to network after disconnection wifi.sta.autoconnect(1) print ("\r\n") --Print network ip address on UART to confirm that network is connected print(wifi.sta.getip()) --Create server and send html data, process request from html for relay on/off. srv=net.createServer(net.TCP) srv:listen(9000,function(conn) --change port number if required. Provides flexibility when controlling through internet. conn:on("receive", function(client,request) local html_buffer = ""; local html_buffer1 = ""; local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); if(method == nil)then _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP"); end local _GET = {} if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do _GET[k] = v end end html_buffer = html_buffer.."<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\">"; html_buffer = html_buffer.."<title>Robokits IOT Server</title></head><body><p><b><font face=\"Arial Black\" size=\"6\" color=\"#0000FF\"><marquee behavior=\"alternate\" bgcolor=\"#FFFF00\">ROBOKITS IOT SERVER </marquee></font></b></p>"; html_buffer = html_buffer.."<table border=\"1\" width=\"11%\" bordercolorlight=\"#000000\" bordercolordark=\"#008000\" height=\"137\"><tr><td style=\"border-style: solid; border-width: 1px\" width=\"91\" bgcolor=\"#CC6600\" align=\"center\"><b>"; html_buffer = html_buffer.."<font face=\"Verdana\" size=\"2\" color=\"#FFFF99\">RELAY1</font></b></td><td style=\"border-style: solid; border-width: 1px\" bgcolor=\"#CC6600\" align=\"center\"><b><font face=\"Verdana\" size=\"2\" color=\"#FFFF99\">RELAY2</font></b></td></tr>"; html_buffer1 = html_buffer1.."<tr><td style=\"border-style: solid; border-width: 1px\" width=\"91\" align=\"center\"><a href=\"?pin=ON1\"><button><font face=\"Verdana\"><b>ON</button></b></font></a></td><td style=\"border-style: solid; border-width: 1px\" align=\"center\"><a href=\"?pin=ON2\"><button><font face=\"Verdana\"><b>ON</button></b></font></a></td></tr>"; html_buffer1 = html_buffer1.."<tr><td style=\"border-style: solid; border-width: 1px\" width=\"91\" align=\"center\"><a href=\"?pin=OFF1\"><button><font face=\"Verdana\"><b>OFF</button></b></font></a></td><td style=\"border-style: solid; border-width: 1px\" align=\"center\"><a href=\"?pin=OFF2\"><button>"; html_buffer1 = html_buffer1.."<font face=\"Verdana\"><b>OFF</button></b></font></a></td></tr></table><p><b><font face=\"Verdana\">Visit our website : <a href=\"http://www.robokits.co.in\">http://www.robokits.co.in </a></font></b></p></body></html>"; local _on,_off = "","" if(_GET.pin == "ON1")then gpio.write(Relay1, gpio.LOW); elseif(_GET.pin == "OFF1")then gpio.write(Relay1, gpio.HIGH); elseif(_GET.pin == "ON2")then gpio.write(Relay2, gpio.LOW); elseif(_GET.pin == "OFF2")then gpio.write(Relay2, gpio.HIGH); end --Buffer is sent in smaller chunks as due to limited memory ESP8266 cannot handle more than 1460 bytes of data. client:send(html_buffer); client:send(html_buffer1); client:close(); collectgarbage(); end) end)

Question owner

I have no idea what you're talking about. Here is a <shft><ctl>E screen of the attempt at 192.168.0.176:9000.

I have no idea what you're talking about. Here is a <shft><ctl>E screen of the attempt at 192.168.0.176:9000.