handle /api/* {
reverse_proxy 172.16.0.138:1999
}
handle /goapi/* {
reverse_proxy 172.16.0.138:8041
}
handle_path /hr/api/* {
reverse_proxy 172.16.0.138:19909/api
}
handle {
root /home/data/html/invitation
try_files {path} /index.html
file_server
}
log {
output file logs/invitation.log {
roll_size 50mib
roll_local_time
roll_keep 500
}
format transform `[{ts}] - {request>headers>X-Forwarded-For>[0]:request>remote_ip} "{request>method} {request>uri} {request>proto}" {status} {size} "{request>headers>Referer>[0]}" "{request>headers>User-Agent>[0]}"` {
time_format "wall_milli"
time_local
}
}
handle_errors {
@block_codes `{err.status_code} in [403]`
handle @block_codes {
respond "Access Forbidden" 403
}
}
Yeah, reverse_proxy doesn’t work that way. You can’t use HTTP path as part of the upstream address in the reverse_proxy directive.
To do what you want to do, use rewrite inside the reverse_proxy stanza.
Or, you can do this:
handle /hr/api/* {
uri strip_prefix /hr
reverse_proxy 172.16.0.138:19909
}
Thank you, that works.