This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

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

  • 24 ردًا
  • 1 has this problem
  • 1 view
  • آخر ردّ كتبه Jim44685

more options

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.

الحل المُختار

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

All Replies (20)

more options

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 ?

more options

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.

more options

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

more options

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?

more options

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 - Support Volunteer

more options

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.

more options

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/

more options

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

Modified by AnnaSycamore

more options

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

more options

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.

more options

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

more options

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.

more options

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?

more options

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

more options

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

Modified by AnnaSycamore

more options

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/

more options

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

more options

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.

more options

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>

<font face=\"Arial Black\" size=\"6\" color=\"#0000FF\"><marquee behavior=\"alternate\" bgcolor=\"#FFFF00\">ROBOKITS IOT SERVER </marquee></font>

"; html_buffer = html_buffer..""; html_buffer1 = html_buffer1..""; html_buffer1 = html_buffer1.."
"; html_buffer = html_buffer.."<font face=\"Verdana\" size=\"2\" color=\"#FFFF99\">RELAY1</font><font face=\"Verdana\" size=\"2\" color=\"#FFFF99\">RELAY2</font>
<button><font face=\"Verdana\">ON</button></font><button><font face=\"Verdana\">ON</button></font>
<button><font face=\"Verdana\">OFF</button></font><button>"; html_buffer1 = html_buffer1.."<font face=\"Verdana\">OFF</button></font>

<font face=\"Verdana\">Visit our website : http://www.robokits.co.in </font>

";


       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)

more options

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.

  1. 1
  2. 2