Anchor links fail on default Shiny server

When I upload Rmd files to my cloud shiny server, hash/anchors like [click me](#tag) does nothing. They work fine when I run it locally in the Rstudio viewer and in all browsers. The link also work as expected on I installed Shiny Server on Ubuntu 18.04 and all settings are default except that I changed site_dir and log_dir in /etc/shiny-server/shiny-server.conf.

What could be the source of this problem and how can I fix it?

To reproduce the problem, consider this minimal Rmd file:

runtime: shiny

[Click this link to go to second heading](#second)

# First {#first}
<div style="height: 3000px;">spaace</div>

# Second {#second}

See this Rmd on my cloud server where the link does not work

See this Rmd on where the link works