ipfs / infra

Tools and systems for the IPFS community

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invalid variable name "\$ipfspath"

NatoBoram opened this issue · comments

Hi! I was trying to use the subdomain redirect config in nginx but I ran into some issues.

[emerg] 16395#16395: invalid variable name "\$ipfspath" in /etc/nginx/sites-enabled/ipfs:27

It seems like this code is giving me quite a few errors.

set \$ipfspath "";
if (\$http_host ~ ^(.+)\.(ipfs|ipns)\.dweb\.link\$) {
set \$ipfspath /\$2/\$1;
}
if (\$ipfspath = '') {
return 404;
}
rewrite "^(.*)\$" \$ipfspath\$1;

Is there something I'm missing?

I got something that works with some clever Googling.

if ($http_host ~ ^(.+)\.(ipfs|ipns)\.dweb\.link$) {
  set $ipfspath /$2/$1;
  rewrite "^(.*)$" $ipfspath$1 last;
}

It seems like the configs were badly copied and auto-escaped somehow. Nginx is pretty obscure to read and write, so it's hard to figure out what was wrong. I think this issue is still valid; the configs in this repo should be corrected.

Sorry, I think this repo not being marked as archive is a mistake

Good news is this is now a feature of go-ipfs.
go-ipfs will now serve the subdomain and issue a redirect to it from /ipfs/bafywhatever automatically in the default gateway config