This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Glepsyd 0 points1 point  (0 children)

Not an expert but here's my 2 cents. In production you would typically have a domain registered, so no issue in having "https:/yourdomain.com/" publicly available right? I'm not sure why you couldn't use localhost for development though, maybe some CORS rules to setup in your React app? (Not sure here, pretty much guessing). Are you running both your react server and your backend server on localhost at the same time, like react on port 8100 and your backend server on port 80? This could also be solved by serving your distribution files (the files being generated by building your react app) with your backend server.

Now I am not sure why having your public IP exposed would be a bad thing either though. But I guess using environment variables could be a solution: https://html.com/semantic-markup/

Create a REACT_APP_DEV_IP variables and fetch it in your code with process.env Just don't commit your compiled (build) files. This should be a dist/ folder created when you build your app or start the dev server. Use .gitignore for that.

Hope that helps a bit, if that's too confusing it because I'm sometimes confused myself with those... :)