Assuming the following, what domain will be HSTS'ed for the next year, foo.com or bar.com? RTFM (RFC6797) doesn't help much.
> GET / HTTP/1.1
> Host: foo.com
[ ... ]
< HTTP/1.1 301 Moved Permanently
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< Location: https://bar.com
.example
TLD instead): maybe the second website also use HSTS with the same headers. But in general MAximillian answer holds: the header protects the ongoing HTTP exchange so applies to the website you are connecting too, whatever happens after the connection (error, serving local page, proxying, redirecting, etc.)