Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
117 views
in Technique[技术] by (71.8m points)

javascript - Can I set the abosulte URL of my grpc web request?

maybe this question is very stupid, but I couldn't find a solution to it. So I have a C# gRPC Backend with two Methods. One of them is the Download Methode. I am also using an envoy proxy gateway, which listens on port 9090 and on the "/" endpoint. If a request comes in there it will forward it to my backend.

Now I want to send a gRPC Request from my react frontend to this backend over the envoy. I am now able to send requests, but the problem is that the gRPC changes the URL to the following: http://localhost:9090/BlobStorage.BlobStorage/Download

The problem is my C# Backend doesn't listen to this. I want to change it to this:

http://localhost:9090/

So now to my question: Is there a possibility to set the absolute URL for my gRPC request?

I am using everything in docker. The frontend uses the gRPC-web package.

This my code for the request:

const blobService = new BlobStorageClient('http://localhost:9090/');

const test = () => {
  var request = new DownloadDataRequest()
  request.setFileid('JPG-2021-01-29-23-01-47-VALFSP');
  request.setDeleteafter(false);

  blobService.download(request, {}, function(err : any, response : any) {
     console.log(err);
     console.log(response);
   });
}
question from:https://stackoverflow.com/questions/66066084/can-i-set-the-abosulte-url-of-my-grpc-web-request

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...