Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

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

  • 24 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 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

定位到答案原位置 👍 0

所有回复 (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?

由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?

由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!

由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

由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

由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

由AnnaSycamore于修改

more options

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

由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