ipfs / go-ipfs-redirects-file

IPFS Web Gateway _redirects file format parser
https://github.com/ipfs/specs/pull/290
MIT License
2 stars 2 forks source link

Support Query Parameters? #20

Open jphastings opened 1 year ago

jphastings commented 1 year ago

Would IPFS be interested in supporting _redirects files with query parameters, similar to Netlify)? (Re: ipfs/kubo#8890). If this seems valuable, I'd put a PR together (here and in ipfs/kubo).

I would find it valuable to be able to write a redirects file similar to the one below, to be able to provide responses to 'dynamic-looking' web-requests (from clients that expect to use specific, query parameter-based, GET APIs) via IPFS:

/things type=:type /things/:type.html 200
/things /things.html 200

(This is identical to the format Netlify uses — only required parameters must be specified.)

GET /things?type=photos → Served from /things/photos.html GET /things → Served from /things.html

jphastings commented 1 year ago

I ended up implementing it anyway 😅

Let me know your thoughts!

aschmahmann commented 9 months ago

This is effectively a spec change so should be resolved via a proposed IPIP change (https://github.com/ipfs/specs/tree/main#interplanetary-improvement-process-ipip) in https://github.com/ipfs/specs.

The proposal template highlights some questions around benefits, alternatives, tradeoffs, etc. that would likely be helpful to reviewers.

From what I can tell it seems like this could potentially introduce problems for users as new proposals come along that natively add query parameters to the URI such as IPIP-402. It would effectively add a sense of non-reproducibility to ipfs:// URIs (i.e. the actual target resource changing not just something like how a directory is rendered in HTML) which seems like something to be avoided if possible.

jphastings commented 9 months ago

Thank you so much @aschmahmann! This is super helpful feedback; I'll review IPIP-402 (and any others referencing the HTTP gateway) and build an IPIP of my own.