Compare Chrome extensions: LiveHosts vs Simple Proxy

Stats LiveHosts LiveHosts Simple Proxy Simple Proxy
User count 10,000+ 1,000+
Average rating 3.47 5.00
Rating count 36 9
Last updated 2022-03-29 2019-05-20
Size 59.17K 319.49K
Version 2.0.0 0.1.8
Short description
Switch your host/IP mappings in real time without editing your hosts file 一个朴素的代理配置扩展
Full summary

LiveHosts is a Chrome extension that aims at providing a working (even if sub-obtimal) solution to a common nuisance that many web developers have to deal with every day. If you have multiple versions of your websites sharing the same host names on multiple environments, you often need to switch the assignments in your OS hosts file.

Other extensions (like the life-saving HostAdmin) can help with the cumbersomeness, but changes to the hosts file usually take an inconvenient amount of time to actually affect the browser.

Unfortunately, there is no way to make Chrome direct requests for a hostname to a specific IP without a standard redirect - you could set up a smart HTTP proxy, but it's often not possible or not convenient.

This extension settles for a sub-obtimal approach: requests to the indicated hostnames are redirected to the chosen IPs with an additional Host header. The browser's address bar reflects this behaviour showing the hostname right after the IP (e.g. http://127.0.0.1/www.example.com/). The extension also tries to take care of all requests to either the IP or the hostname in a consistent way.

Issues

After the redirect, the user is effectively in a different domain that the one they expected. They may notice some functional differences:

  • depending on the server, parts of a web page referring to the site URL (like href and src attributes) could be different from the original
  • window.location has a different value that can potentially throw off JavaScript snippets
  • most Cross-Origin request won't work

通过预先配置需要代理的域名或者 URL 及其对应的目标服务器,然后快速的在各个目标服务器间进行切换。

该扩展主要是为了解决前后端分离开发(如 Vue 项目)的过程中,反向代理配置比较麻烦,且需要重启服务的问题: 在前后端分离开发(如 Vue 项目)的过程中,我们经常需要配置反向代理( 如 Vue 项目的 proxyTable )来与真实的 API 服务器交换数据;但是

  1. 同一个项目可能经常需要和不同的后端开发同事协作,此时不可避免的就需要修改前端服务的反向代理配置;
  2. 前端的测试服务器也需要能够让客户端决定连接哪个 API 服务,如果直接配置反向代理,则需要根据客户端测试需要调整代理配置。

同时,也间接的能够支持其他代理类扩展的代理工作,只是配置方式稍显不同。