Hi,
Have you seen the Proxy base url setting Global Settings — GeoServer 2.27.x User Manual?
-Jukka Rahkonen-