Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gateway: add path prefix for directory listings #1971

Merged
merged 1 commit into from
Nov 20, 2015
Merged

Conversation

ghost
Copy link

@ghost ghost commented Nov 16, 2015

The other option would be a config option to rule them all. This one here, lets the reverse proxy signal the path prefix, which allows having the same gateway accessible at multiple paths.

Fixes #1955

License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
@ghost ghost added the topic/gateway Topic gateway label Nov 16, 2015
@jbenet jbenet added the status/in-progress In progress label Nov 16, 2015
@ghost ghost added the RFCR label Nov 16, 2015
@daviddias daviddias mentioned this pull request Nov 16, 2015
42 tasks
@ghost ghost mentioned this pull request Nov 16, 2015
53 tasks
hdr := r.Header["X-IPNS-Original-Path"]
if len(hdr) > 0 {
originalUrlPath = hdr[0]
if hdr := r.Header["X-Ipns-Original-Path"]; len(hdr) > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change going to break anyone? or are headers case insensitive?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

net/http seems to convert response header keys to camel-case. I passed X-IPFS-Gateway-Prefix from nginx, and it arrived in the gateway handler as X-Ipfs-Gateway-Prefix. I only changed X-IPNS-Original-Path too for the sake of consistency and avoiding happy accidents.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding breaking existing stuff by changing the header: it's implementation detail between IPNSHostnameOption and gateway handler

jbenet added a commit that referenced this pull request Nov 20, 2015
gateway: add path prefix for directory listings
@jbenet jbenet merged commit 93c2309 into master Nov 20, 2015
@jbenet jbenet removed the status/in-progress In progress label Nov 20, 2015
@jbenet jbenet deleted the gateway-url-rewrites branch November 20, 2015 09:35
@ghost ghost mentioned this pull request Nov 21, 2015
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gateway Topic gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gateway: needs to better support URL rewrites
1 participant