We examine how the mass assembly of central galaxies depends on their location in the cosmic web. The HORIZON-AGN simulation is analysed at z ∼ 2 using the DISPERSE code to extract multi-scale cosmic filaments. We find that the dependency of galaxy properties on large-scale environment is mostly inherited from the (large-scale) environmental dependency of their host halo mass. When adopting a residual analysis that removes the host halo mass effect, we detect a direct and non-negligible influence of cosmic filaments. Proximity to filaments enhances the build-up of stellar mass, a result in agreement with previous studies. However, our multi-scale analysis also reveals that, at the edge of filaments, star formation is suppressed. In addition, we find clues for compaction of the stellar distribution at close proximity to filaments. We suggest that gas transfer from the outside to the inside of the haloes (where galaxies reside) becomes less efficient closer to filaments, due to high angular momentum supply at the vorticity-rich edge of filaments. This quenching mechanism may partly explain the larger fraction of passive galaxies in filaments, as inferred from observations at lower redshifts.