TransWikia.com

Does having Frontend and Backend on the same port any consequences?

Information Security Asked by Kepotx on October 28, 2021

I am currently working on a mean application, with an Angular frontend and an express/node backend. Frontend and backend communicate together with a REST API.

When I deploy the application, both the Angular front-end and the API back-end are served from the same port.

What consequences do running both on the same ports have, instead of separate port for each part?

2 Answers

The only consequence that I'm aware of for the markup and API being hosted from the same port on the same server is that they will be considered the same domain in terms of how browsers treat the request. This is actually a good thing in terms of security. It means that you do not have to be concerned with configuring CORS, and dealing with any potential misconfigurations.

Answered by Dan Landberg on October 28, 2021

Let's say you have 2 Servers running different APIs and want them to communicate with each other. If client and server are on the same port, they will not be able to communicate since the port is already on listen mode.

Answered by Thiago Escobar on October 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP