C
C#13mo ago
Annabelle

Ocelot/Yarp a valid use-case for the following react/asp.net?

Hello there I'm currently working on application and I want to use C# AspNet for the backend, and for frontend I want react. Issue is regarding the security. I wanted to go with JWT access/refresh token, but try not to use localStorage, and only way would be to use http only cookies and I can only set that inside of C# As the asp net project, and frontend are 2 different domains I cannot easily work with cookies between them. Idea is to use Ocelot/Yarp to create following match: route starts with /api -> redirect to my C# asp net project everything else needs to go to the react side So just a gateway Then authentication would be easier as we can use one domain, and react will be able to fetch session from some route /session Do you think I'm on the right track here, or any better ideas?
8 Replies
Scratch
Scratch13mo ago
yarp, it's a good use for it
Annabelle
AnnabelleOP13mo ago
Have you used it for suche scenario ? Did you encounter any issues or it was reletevly simple
Scratch
Scratch13mo ago
nope, but I've used reverse proxies like nginx for it
Annabelle
AnnabelleOP13mo ago
Yeah in prod I think I'll use nginx ingress But for dev I need some way to test it out Thank you for your help
Scratch
Scratch13mo ago
why not use nginx in dev?
Annabelle
AnnabelleOP13mo ago
harder to setup on windows maybe with docker but idk how to setup debug env with docker compose what do you think ?
Scratch
Scratch13mo ago
you don't need to attach a debugger to nginx
Annabelle
AnnabelleOP13mo ago
But I would to react/c# nginx yeah not needed not sure if possible with compose I know you can with 1 dockerfile
Want results from more Discord servers?
Add your server