Comments (4)
Hm... I get it now. Thank you for explanation @whizzzkid!
I think the tradeoff would be net positive. The inlined DNSLink identifier on subdomain is a rather a niche use case, most DNSLink+Companion users will visit DNSLink website using the original URL.
We would have a single static rule per subdomain gateway, no need for constant rule-miss and retractive updates:
- Origin
^https?://(.*?).(ipfs|ipns).dweb.link/(.*)
- Target:
http://localhost:8080/\2/\1/\3
As for cosmetics, replacing -
→ .
during the redirect from path to subdomain when protocol scheme has no TLS is something boxo/gateway
(Kubo) can implement and ship in near future.
Kubo already does things like normalization of CIDv0 to CIDv1 or switching to Base36 (example) when Base32 would be too long for IPNS Name to fit in a single DNS Label (ipfs/kubo#7318). I think it is sensible if we decode inlined DNS before making the redirect too.
This only impacts internals of subdomain redirect from public to local gateway. Functionally, there is no bug.
I don't want to block MV3 release on this.
@whizzzkid so feel free to park this fix until we have Kubo with necessary normalization logic (i've opened ipfs/boxo#462 but tbd if this will get into Kubo 0.23 or 0.24).
from ipfs-companion.
@lidel it looks like this is a invalid edge case
Source: https://cid-ipfs-tech.ipns.dweb.link/
Redirect: https://localhost:8080/ipns/cid.ipfs.tech/
the rule add just updates the redirect if the source is the same, because we don't want to break the current redirect. However, that example is weird because -
get converted to .
which is handled, but instead if you use a better url: https://cid.ipfs.tech.ipns.dweb.link/ it works as intended. Are hyphen allowed to be converted to periods?
![Screenshot 2023-09-17 at 2 48 29 AM](https://private-user-images.githubusercontent.com/1895906/268491893-816a7ce1-8bb4-4b47-9034-ac850ced51d7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkwNzQxNDIsIm5iZiI6MTcwOTA3Mzg0MiwicGF0aCI6Ii8xODk1OTA2LzI2ODQ5MTg5My04MTZhN2NlMS04YmI0LTRiNDctOTAzNC1hYzg1MGNlZDUxZDcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDIyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAyMjdUMjI0NDAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjkyY2QwYjMxODdiZmIzOGYwNGE5YjY4NTUyZWZmN2MyMjhiMWY5YmNkMWI2YjVmYzBlZDU1OTdkMzkwNTg0NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.KAkCV9UeG0LCx6Swssi6Jz3ATR0zFL3HpXblEBWY-sY)
from ipfs-companion.
@whizzzkid Could be that i've pasted cid.ipfs.tech.ipns.dweb.link
instead of cid-ipfs-tech.ipns.dweb.link
, but we need to do the right thing in both cases because the former is valid for http://
URL, and the latter is required for https://
.
Subdomain gateways on https://
have to use inlined names which have all .
replaced with -
(see the algorithm from https://specs.ipfs.tech/http-gateways/subdomain-gateway/#host-request-header) because of TLS wildcard certificates like *.ipns.dweb.link
.
TLS wildcard certs work only for a single DNS label, so we can't have .
in the domain name on the left side of .ipns.
.
So if you have captured a value under subdomain like (value).ipns.dweb.link
, and the value has no .
and has at least one -
and is not a valid CID, you need to convert it back from the inlined version to a DNS name.
- replace every single
-
with.
- replace every double
--
with-
Good one for testing is https://en-wikipedia--on--ipfs-org.ipns.dweb.link/ as it had both.
from ipfs-companion.
@lidel in that case, we cannot do anything about this. The declarative rules are designed to be static in nature. The most we can do is regex manipulation. So capturing group and replacing it in the redirect is the best we can do.
Which means in the example:
Source: https://en-wikipedia--on--ipfs-org.ipns.dweb.link/
Current: http://localhost:8080/ipns/en.wikipedia-on-ipfs.org
which translates to http://en.wikipedia-on-ipfs.org.ipns.localhost:8080/
New: http://localhost:8080/ipns/en-wikipedia--on--ipfs-org
which will translate to http://en-wikipedia--on--ipfs-org.ipns.localhost:8080/
which will work, but is that an acceptable tradeoff? The regex would be simple i.e. find whatever the path is and place the group in there, remember we cannot replace -
->.
and --
-> -
on the fly.
from ipfs-companion.
Related Issues (20)
- [MV3 Beta Bug] Recovery Redirect Loop HOT 1
- [MV3 Beta Bugs] browserAction updates broken in Firefox HOT 1
- [MV3 Beta Bugs] Invalid "Target" in Redirect Rules UI
- Refactor E2E tests
- Brave: synchronize settings when backend is "Provided by Brave" HOT 1
- Intro screen cleanup
- [MV3 Beta Bug] Redirect infinite loop with Brave when hitting "purple IPFS button" HOT 4
- [Epic] Helia Node Type HOT 2
- the IPFS companion is disabled even with Kubo is running HOT 19
- #x-ipfs-companion-no-redirect opt-out does not work in 3.0.0
- e2e Tests are broken HOT 1
- Disable Brave redirect when Companion global redirect is enabled HOT 3
- Optional injection into page context menu HOT 2
- feat: upgrade countly sdk HOT 2
- test: re-enable firefox tests in e2e
- Migrate publishing setup to ipfs.tech HOT 2
- / \ ~~~°•Fibonacci •°~~~ ↕️ / \ HOT 2
- Remove countly.ipfs.tech telemetry
- ipfs://example.com in Chromium should produce error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipfs-companion.