将 Firefox 切换为使用与 windows.host 文件中不同的 DNS

发布于 2024-07-13 08:54:07 字数 111 浏览 3 评论 0原文

例如,我在不同的服务器上有一个开发站点,但我正在尝试从实时站点复制内容,因此将实时站点放在 IE 中而将开发站点放在 FF 中会很方便。

我尝试了 FoxyProxy 但似乎无法让它工作。

For example, I have a development site on a different server but I'm trying to copy content over from the live site so it'd be handy to have the live site in IE and the dev site in FF.

I tried FoxyProxy but I can't seem to get it to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

软的没边 2024-07-20 08:54:07

我用它来用 localserver 覆盖系统的 DNS

在关于:配置中

更改此值:

  • network.dns.forceResolve
  • network.dns.ipv4OnlyDomains
  • network.dns.localDomains
  • 带有本地 DNS 服务器的 IP 地址(例如 192.168.1.88)

    对不起我的英语

    I use this to override system's DNS with localserver

    in about:config

    change this value:

  • network.dns.forceResolve
  • network.dns.ipv4OnlyDomains
  • network.dns.localDomains
  • with IP address of local DNS server (for exsample 192.168.1.88)

    Sorry for my english

    假装爱人 2024-07-20 08:54:07

    现在可以使用 DNS over HTTPS 功能:

    打开“选项”、“常规”,滚动到最底部并打开“网络设置”,

    在最底部,您可以找到“DNS over HTTPS”:

    dnsOverHttps


    您有要在更改此设置之前使用 about:config ,请参阅以下文档:

    在 Firefox 地址栏中键入 about:config

    搜索:
    network.trr.uri

    您可以使用以下 DNS 服务器之一:

    Cloudflare: https://cloudflare-dns.com/dns-query
    Google: https://dns.google/dns-query
    Secure DNS EU: https://doh.securedns.eu/dns-query
    Quad 9: https://dns.quad9.net/dns-query
    

    并将 network.trr.mode 设置为 1

    从此处劫持:
    https://www.ghacks.net/ 2018/04/02/configure-dns-over-https-in-firefox/

    It's now possible, with the DNS over HTTPS function:

    Open Options, General, scroll to very bottom and open Network Settings,

    On the very bottom, you can find DNS over HTTPS:

    dnsOverHttps


    You had to use about:config before to change this setting, here's for documentation:

    Type about:config in firefox address bar.

    search for:
    network.trr.uri

    You can use one of the DNS servers below:

    Cloudflare: https://cloudflare-dns.com/dns-query
    Google: https://dns.google/dns-query
    Secure DNS EU: https://doh.securedns.eu/dns-query
    Quad 9: https://dns.quad9.net/dns-query
    

    And set network.trr.mode to 1

    Hijacked from here:
    https://www.ghacks.net/2018/04/02/configure-dns-over-https-in-firefox/

    泪冰清 2024-07-20 08:54:07

    从您的问题来看,您已经拥有第二组可用的 DNS 服务器,它们引用开发站点而不是实时站点。

    我建议您只需在该 DNS 服务器系统或低端备用系统上运行标准 SOCKS 代理,并将该系统配置为使用开发 DNS 服务器。 然后,您可以告诉 Firefox 使用该代理而不是直接下载页面。

    通过这种方式,实际的 DNS 查找将在代理计算机上完成,而不是在运行 Web 浏览器的计算机上完成。

    It appears from your question that you already have a second set of DNS servers available that reference the development site instead of the live site.

    I would suggest that you simply run a standard SOCKS proxy either on that DNS server system or on a low-end spare system and have that system configured to use the development DNS server. You can then tell Firefox to use that proxy instead of downloading pages directly.

    Doing it this way, the actual DNS lookups will be done on the proxy machine and not on the machine that's running the web browser.

    海夕 2024-07-20 08:54:07

    DNS 解析通常在系统级别完成,而不是在应用程序级别完成,因此通常不能让一个程序使用一个 dns,而另一个程序使用不同的 dns。 我不知道有任何 Firefox 扩展允许您使用不同的 dns。

    DNS resolving is usually done at the system level and not at the application level, so you can't normally have one program use one dns and another program use a different dns. I'm not aware of any firefox extensions that allow you to use a different dns.

    堇年纸鸢 2024-07-20 08:54:07

    为您的开发服务器和产品服务器使用不同的名称怎么样? 这应该可以避免任何混淆,并且您不必每次都编辑主机文件。

    What about having different names for your dev and prod servers? That should avoid any confusions and you'd not have to edit the hosts file every time.

    撩人痒 2024-07-20 08:54:07

    我正在使用 SwitchHost 扩展来解决这个问题:
    https://addons.mozilla.org/en-US/firefox/addon/ 14258

    配置简单,切换主机更容易。

    I am using the SwitchHost extension exactly for this problem:
    https://addons.mozilla.org/en-US/firefox/addon/14258

    It is easy to configure, and even more easy to switch hosts.

    魂牵梦绕锁你心扉 2024-07-20 08:54:07

    我想知道你是否可以为 Fiddler 编写一个自定义规则来执行你想要的操作? IE 不使用代理,Firefox 指向 Fiddler,Fiddler 使用自定义规则将请求定向到开发服务器...

    http ://www.fiddlertool.com/fiddler/

    I wonder if you could write a custom rule for Fiddler to do what you want? IE uses no proxy, Firefox points to Fiddler, Fiddler uses custom rule to direct requests to the dev server...

    http://www.fiddlertool.com/fiddler/

    爱人如己 2024-07-20 08:54:07

    由于 http 代理协议类似于原始 http 协议,因此您可以通过告诉 Firefox 它是代理服务器来将所需流量重定向到您的开发服务器。

    有两个限制:

    A. 这不会让您使用 https 连接。

    B. 一些框架(例如:wordpress)不喜欢这种方法,并且以错误的方式重定向请求,

    只需将以下代码复制到 .pac 文件中(当然,输入您的站点域名和 IP 地址),然后切换开发/生产只需更改代理配置即可。

    function FindProxyForURL(url, host) {
        var prox4site = {
            "mysite.com":"PROXY 10.0.1.100:80",
            "www.mysite.com":"PROXY 10.0.1.100:80"
        }
    
        return prox4site[host] || "DIRECT";
    }
    

    Since http proxy protocol is similar to raw http protocol, you can redirect desired traffic to your development server by telling firefox it's a proxy server.

    two limitations:

    A. this won't let you use https connections.

    B. some frameworks (e,g: wordpress) don't like this method and redirect the request the wrong way

    just copy the following code into a .pac file (enter your site domain and IP address, of course), and switch development/production just by changing proxy configuration.

    function FindProxyForURL(url, host) {
        var prox4site = {
            "mysite.com":"PROXY 10.0.1.100:80",
            "www.mysite.com":"PROXY 10.0.1.100:80"
        }
    
        return prox4site[host] || "DIRECT";
    }
    
    祁梦 2024-07-20 08:54:07

    转到选项->高级->网络->设置->自动代理配置 url,然后输入 8.8.8.8 所有 Mozilla 流量现在都使用 Google dns。

    Go to options->Advanced->Network->Settings->Automatic proxy configuration url and enter 8.8.8.8 All you Mozilla traffic uses Google dns now.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文