私はipInfoを使ってMeteor APPでユーザーのIPを取得します。ローカルのdevで、ipInfoは良いデータを返します:私のip。
しかし、私のプロダクションサーバでは、ipInfoは私のサーバからIPを返し、ipクライアントは返しません:
import { HTTP } from "meteor/http";
Meteor.methods({
getIp: function() {
let request = Meteor.wrapAsync(HTTP.get),
result = request("http://ipinfo.io");
console.log(result); // Good on local, but only server IP on production
return result;
}
});
誰でも私を助けることができますか?
回答:
回答№1は1まず、クライアント側からipInfoを呼び出さなければなりません。
サーバーから呼び出す場合は... onConnection クライアントIPを取得する機能と、ipInfo
クライアントからサーバーサイドメソッドを呼び出す場合は、 this.connection.clientAddress
あまりにも....