I've written a PHP backend that checks if a request is coming from an authorized user. This is done as simple as using the following code
if(!isset($_SESSION["id"])){
http_response_code(403);
die("Error. Unauthorized user.");
}
This is perfectly okay in production, but in development I face issues, because angular app running on local development server does not send cookies (nor does the server store it).
How can I configure angular server/app to send session cookies during development? I am using the following code to start an app
ng serve --port 4000 --host example.com --ssl true --sslKey path --sslCert path2
UPDATE
I don't want to change my app logic or anything. this is solley to make development manageable. I need to send cookies at ng serve
or configure node server to send cookie when it operates. Also if use one version in production, and another in development (as the forcefully implied answer suggests), I need to change it every time push an update and then change it back, leaving me with 2 versions. terrible, terrible practice
UPDATE 2:
For additional answer see this Q&A: sending cookies in Angular app and Access-Control-Allow-Origin in development mode