场景
在虚拟机上开启了服务器,但是服务器的ip会发生变化,一旦服务器ip发生变化,所有aip的ip和port都要跟着修改,这样非常麻烦。
解决方案
使用postman的代理的自定义代理。关于自定义代理官方描述:
Use the custom proxy if all of your applications need to use the same proxy.
Turn custom proxy on if you want to direct the requests from Postman go through a custom proxy server.
Turning it off will direct the requests to not use the proxy server.
也就是说,api中的ip和port全部会被替换成指定的ip端口,这样就在服务器ip发生变化时,只需要调整代理ip即可。
配置方法
file >> settings >> Proxy >> 勾选add a custom proxy configuration
,并配置对应ip和端口,如需要验证,则填写对应验证。