Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

c# - Passing cookies through ngrok

I have backend + database running on localhost:81, and my frontend which is a separate app on my_local:3000.

Now, my frontend needs to communicate with the backend through ngrok due to external services.

So, my app uses the my-local.ngrok.io as API domain, which then forwards the requests to localhost:81.

All of that works fine, but the problem is the cookies. The backend is not able to set cookies for both the ngrok, and the my_local, which means that my requests are unauthorized.

Is there a way for cookies to be set for both domains? We tried simply adding both domains in the BE, and I see the cookies as part of the response, but they never get set on my_local.

My FE is a react app, BE is C# if that helps.


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

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...