magento2 – Static content served from http://localhost instead of http://localhost:8888

Probably a simple question but I have installed magento 2.4 and I am getting console errors like the one below:

Access to font at 'http://localhost/magento2/pub/static/version1610053755/frontend/Magento/luma/en_GB/fonts/opensans/light/opensans-300.woff2' from origin 'http://localhost:8888' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

This looks to me because it is requesting the static resources from http://localhost instead of http://localhost:8888.

Does anyone know how to change this behavior.