brookshi / Hitchhiker

a Restful Api test tool
http://www.hitchhiker-api.com
Other
2.19k stars 402 forks source link

about install ip input #212

Open de1ck opened 6 years ago

de1ck commented 6 years ago

2xu f_1bo59s9ni15mf mj 在安装第一步的时候,如果在输入框中填写的是localhost的时候在局域网内的其他电脑通过ip访问的时候当进入首页正常,但是发送ajax请求的时候(免登陆操作)默认为localhost前缀,导致fench error(以及跨域问题)。 但是如果配置ip为为电脑首选IPv4地址(192.168...)的时候可以正常登录(发送ajax请求) project中的配置localhost只是替换集合中创建请求的时候localhost对应的映射 @brookshi

brookshi commented 6 years ago

如果想局域网内一起使用,必须用ip

de1ck commented 6 years ago

@brookshi 我不清楚fetch的请求方式,但ajax中的所有url不应该根据ip写死,而是根据地址栏的origin变换,这样当电脑的ip改变后,服务仍然可以使用,也不造成跨域问题。

Sent from my Honor 9 using FastHub

brookshi commented 6 years ago

正常确实应该用相对路径的,印象中当初有个什么问题导致我用绝对路径了,回头再想想