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.

Search Support

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

Èròjà atẹ̀lélànà yii ni a ti fi pamọ́ fọ́jọ́ pípẹ́. Jọ̀wọ́ béèrè ìbéèrè titun bí o bá nílò ìrànwọ́.

Firefox loads wrong port on localhost unless hard refreshed

  • 8 àwọn èsì
  • 1 ní ìṣòro yìí
  • 2 views
  • Èsì tí ó kẹ́hìn lọ́wọ́ natemara

more options

When running multiple web servers on my computer, Firefox does not behave correctly when navigating between them.

Service 1: port 8080 Service 2: port 9090

For illustration purposes, I created a simple server that just sends back the port and URL path that you requested in the form:

Hello, you've hit 8080/foo/bar

If you request http://localhost:8080/foo/bar for example.

Here's what happens:

1. Navigate to localhost:8080/foo - browser displays "Hello, you've hit 8080/foo" - this makes sense

2. Navigate to localhost:9090/foo in the same tab - browser displays "Hello, you've hit 8080/foo" - this does not make sense since I've changed the port

3. Navigate to localhost:9090/foo/bar - browser displays "Hello, you've hit 8080/foo/bar" - this really does not make sense since I've changed the port and the path

4. Hard refresh (Ctrl-Shift-R) - browser displays "Hello, you've hit 9090/foo/bar"

I've tried this with a brand new install of the latest FF, running in safe mode, and the issue is still present. I don't know what is causing this issue, but as a web developer that frequently runs multiple local servers, it's infuriating. The servers on the different ports don't need to be in the same tab to mess with each other either. I've tried this with Chrome on the same computer, and it works perfectly, so it's not a problem with the network stack on my laptop.

Has anyone else experienced something like this?

EDIT: I noticed that when I use separate container tabs, this issue goes away. This helps a little, but I still have use cases where this does not help.

When running multiple web servers on my computer, Firefox does not behave correctly when navigating between them. Service 1: port 8080 Service 2: port 9090 For illustration purposes, I created a simple server that just sends back the port and URL path that you requested in the form: Hello, you've hit 8080/foo/bar If you request http://localhost:8080/foo/bar for example. Here's what happens: 1. Navigate to localhost:8080/foo - browser displays "Hello, you've hit 8080/foo" - this makes sense 2. Navigate to localhost:9090/foo in the same tab - browser displays "Hello, you've hit 8080/foo" - this does not make sense since I've changed the port 3. Navigate to localhost:9090/foo/bar - browser displays "Hello, you've hit 8080/foo/bar" - this really does not make sense since I've changed the port and the path 4. Hard refresh (Ctrl-Shift-R) - browser displays "Hello, you've hit 9090/foo/bar" I've tried this with a brand new install of the latest FF, running in safe mode, and the issue is still present. I don't know what is causing this issue, but as a web developer that frequently runs multiple local servers, it's infuriating. The servers on the different ports don't need to be in the same tab to mess with each other either. I've tried this with Chrome on the same computer, and it works perfectly, so it's not a problem with the network stack on my laptop. Has anyone else experienced something like this? EDIT: I noticed that when I use separate container tabs, this issue goes away. This helps a little, but I still have use cases where this does not help.

Ti ṣàtúnṣe nípa natemara

All Replies (8)

more options

If you check your logs on the server, can you tell whether Firefox is hitting the correct server each time, or whether it is ignoring the port? (I don't know if you can determine that from a combined log...) Obviously Firefox should NOT ignore the port when making a request.

If Firefox is hitting the correct server, it sounds like a cache problem. I don't know why the cache would disregard the port number. Does it make any difference if you send a cache-control: no-store header?

more options

Based on the logs, Firefox is definitely ignoring the port until I do a hard refresh.

more options

I've tried adding the cache-control header, and it doesn't help. I've also tried changing the port number to a port with nothing running on it, but it still sends the request to the old port. In the attached pic, there is nothing running on my port 1200.

more options

Hmm, could you try minimizing DNS caching. I think these are the relevant settings:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.

(2) In the search box above the list, type or paste dnsc and pause while the list is filtered

(3) Double-click each preference to display a dialog where you can enter the desired value, then click OK:

  • network.dnsCacheEntries => try reducing to 1
  • network.dnsCacheExpiration => try reducing to 1
  • network.dnsCacheExpirationGracePeriod => try reducing to 1

Does that make any difference?

more options

That did not make any difference, no.

more options

Can you test whether the problem is specific to IPv6 addressing? There's a separate preference for that. This isn't a fix, but could be useful information when you formally file a bug.

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.

(2) In the search box above the list, type or paste dns and pause while the list is filtered

(3) Double-click the network.dns.disableIPv6 preference to switch the value from false to true


To file a bug:

more options

That did not change the behavior at all. Thanks though.

more options