Nginx /foo and /foo/ redirects
One could replace

rewrite /(.*) /ipns/QmdpoFuwY/$1 break;


with

rewrite ^(.*[^/]) /ipns/QmdpoFuwY/$1 break;


and try again.

The issue was solved by inspecting the logs. If for example one navigated to /foo/ instead of /foo/ the log indicated:

2017/10/15 14:51:28 [error] 7#7: *1 "/etc/nginx/html/index.html/foo.html" is not found (20: Not a directory)


It turned out that the regex did not match /foo/. One could also enable the rewrite logging to facilitate debugging:

rewrite_log on;