Generally speaking to pass control to another location block you should use internal redirects (rewrite), not proxy_pass:
location / {
rewrite ^.*$ /actual;
}
To modify upstream headers you can use proxy_set_header:
location /actual {
proxy_set_header Cache-Control '<your value>';
}
To modify downstream headers you can use more_set_headers. It requires custom Nginx build with additional module, but it's really powerful in your case:
location /actual {
more_set_headers 'Cache-Control: <your value>';
}
Taking into account the title of the question you can also make hardcore things like switching servers to handle clients traffic. I would NOT recommend it for such trivial tasks, but in rare cases it could help:
http {
upstream internal_http_routing {
server unix:var/internal.sock;
}
server {
# Internal interface
listen unix:var/internal.sock;
location / {
return 200;
}
}
server {
# Client-facing interface
listen 443 ssl;
location / {
proxy_pass http://internal_http_routing;
}
}
}
tcp {
upstream internal_tcp_routing {
server unix:var/internal.sock;
}
server {
# Client-facing interface
listen 8443 ssl;
proxy_pass internal_tcp_routing;
}
}