ipfs / infra

Tools and systems for the IPFS community
MIT License
133 stars 41 forks source link

invalid variable name "\$ipfspath" #510

Closed NatoBoram closed 2 years ago

NatoBoram commented 2 years ago

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.

https://github.com/ipfs/infra/blob/a1334dd5b0c4fbf7ba6d7ba9af53675baf74494f/ipfs/gateway/nginx.conf#L342-L350

Is there something I'm missing?

NatoBoram commented 2 years ago

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.

thattommyhall commented 2 years ago

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