Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

invalid variable name "\$ipfspath" #510

Closed
NatoBoram opened this issue Mar 17, 2022 · 2 comments
Closed

invalid variable name "\$ipfspath" #510

NatoBoram opened this issue Mar 17, 2022 · 2 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@NatoBoram
Copy link

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?

@NatoBoram NatoBoram added the need/triage Needs initial labeling and prioritization label Mar 17, 2022
@NatoBoram
Copy link
Author

NatoBoram commented Mar 17, 2022

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
Copy link
Member

thattommyhall commented Mar 25, 2022

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants