0:00 All right. So now let's go to our backend server, 0:04 and we need 0:04 to change two places to enable CORS. 0:07 The first is gonna be our NestJS HTTP server 0:11 that actually receives traffic. So to do this, we can simply call 0:15 app.enablecors to enable cross-origin resource sharing. 0:19 So this is gonna go ahead and enable it globally. 0:22 Now, you can configure CORS further, so you can also 0:26 specify an explicit origin if you wanted. 0:29 So we could say here that we only want to accept traffic 0:33 from our known UI URL, this one here, 0:37 and enter it in as the origin, and that would restrict traffic just to this 0:40 origin, 0:41 so it would be a little bit more secure. 0:43 However, I'm just going to enable this all together 0:46 and accept all 0:47 URLs. For now, we have enabled CORS on the HTTP server. 0:51 We also need to go to the app module and specify on the 0:55 GraphQL module itself, we need to specify 0:58 CORS to true. So this is gonna enable CORS on our 1:02 actual GraphQL. So this is the only two changes we're gonna need 1:06 to make 1:06 to essentially open up our backend server to traffic from 1:10 other domains. Let's go ahead and push this up. 1:14 All right, so Elastic Beanstalk has updated from our 1:16 latest change, and now 1:17 I go back to the UI and refresh, and we can actually see that 1:22 our GraphQL call is now succeeding to our cross-origin request, 1:26 which is awesome. We can see our sign-in form painting 1:29 and our app is 1:30 working properly. Now, important to note, Chrome will still go 1:34 ahead and mark this connection as not fully secure, and this is 1:37 because of this insecure call we make to our backend 1:41 server. This backend server has, as we know, an insecure 1:45 self-signed certificate that we uploaded, and Chrome actually
The rest of the transcript is for members.
Sign in