Headers already sent when I try to add headers via a shortcode

You can’t add headers after content has already been sent to the browser. If you try, you will get those “Warning Cannot modify header information – headers already sent by… ” messages.

Shortcodes execute inside the the_content filter, and that filter runs well into a page load. That means that content has long since been sent to the browser by the time you try to add headers. To make this work with a shortcode you’d need to do something like what is done here, but honestly, I’d recommend not using a shortcode. That isn’t the right tool for altering early page load content.

I can’t tell exactly what you are doing, but my gut feeling is that a custom meta field would be a better choice.