server
{
listen 80;
server_name a.com b.com c.com;
location ~* ^/comment/(.*) {
proxy_set_header HOST shared.com;
# $1 - stores capture from the location on top
# $is_args will return ? if there are query params
# $args stores query params
proxy_pass http://comment/$1$is_args$args;
}
}
server {
listen 80;
server shared.com;
location / {
# Proxy to some app handler
}
}
upstream comment {
server localhost; # or any other host essentially
}