Yes, mid-contract price rises for broadband bills are legal in the UK. Providers often increase prices annually based on inflation, which affects customers even if they're midway through their contracts.
While some providers may allow cancellation without fees, many clauses in their terms and conditions restrict the ability to cancel mid-contract due to price hikes.