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

Endpoint is currently "bucket.domain" instead of "domain/bucket" #165

Closed
Reregistered opened this issue Apr 7, 2013 · 14 comments
Closed

Comments

@Reregistered
Copy link

Is there a reason the first format is preferred ?

In the case of a bucket name of the format
bucket.name
the prefix mode fails w/ https. While not strongly tested, there may be a performance advantage w/ the former as well

https://stackoverflow.com/questions/5907622/which-way-of-referencing-s3-files-is-better-faster

@domenic
Copy link
Contributor

domenic commented Apr 8, 2013

Sigh. This is a constant recurring question. And, I'm no longer sure what the right answer is. Here's the first place I answered it.

In short, Amazon explains why virtual host-style (bucket.domain) is preferred here and here. In short:

The path-style syntax, however, requires that you use the region-specific endpoint when attempting to access a bucket.

and, more damningly

You cannot make a request to a bucket created with <CreateBucketConfiguration> using a path-style request; you must use the virtual hosted-style request.

That is, you cannot use programmatically-created buckets using the path-style (domain/bucket) access.


On the other hand:

When using virtual hosted-style buckets with SSL, the SSL wild card certificate only matches buckets that do not contain periods. To work around this, use HTTP or write your own certificate verification logic.

which has caused many questions, e.g. #153 and #125.


I suppose we could make this configurable.

@Reregistered
Copy link
Author

Thanks for taking the time to answer it (yet again), I hadn't seen the previous issues and will close this one.

@domenic
Copy link
Contributor

domenic commented Apr 8, 2013

No, let's leave it open. I'll probably make it configurable, since this does keep recurring. At the very least I need to add something to the readme :).

@domenic domenic reopened this Apr 8, 2013
@Reregistered
Copy link
Author

Cool. Currently I'm using a fork just before this change :) which is working well

@domenic
Copy link
Contributor

domenic commented Apr 8, 2013

Eek, I don't want to drive people back to the bad old days of Knox 0.0.9! Haha.

@Pomax
Copy link

Pomax commented Apr 26, 2013

making it a client option would be nice, so you aren't forced into either, but can pick whichever matches your endpoint pubilcation. new Client() with an option a la {format: "path"} vs. {format: "domain"} or the like?

domenic added a commit that referenced this issue Apr 26, 2013
Lots of changes to client creation:
 - Add new `style` option, which can be either `"virtualHost"` (default, and the current behavior: "bucket.endpoint") or `"path"` (uses "endpoint/bucket").
 - Removed the `domain` option, since it was incoherent. What we used to call "domain," Amazon called "endpoint" (i.e. the term "endpoint" was misused).
 - `client.region` is now normalized to always exist, if no custom endpoint was passed, or to be `undefined` if it was.

Also:
- Tests converted to BDD style for easier nesting and repetition of tests.
- Tests clean up after themselves, in all buckets, better.
@domenic
Copy link
Contributor

domenic commented Apr 26, 2013

I am working on this in a branch. The API will be a new option, { style: "path" } vs. { style: "virtualHost" } with the latter being the default. In general creation is going to change for the better, e.g. abolishing domain in favor of using the term endpoint correctly, and always escaping and normalizing URLs properly, etc.

To do this I needed to refactor the tests though, to run through the test suite twice (once for each style), so I took it as an opportunity to overhaul the tests generally, e.g. convert to BDD. I'm most of the way through that, with just signedUrl.test.js and auth.test.js left.

@timmywil
Copy link

timmywil commented May 1, 2013

@domenic : How's it going? Close to landing?

@domenic
Copy link
Contributor

domenic commented May 1, 2013

@timmywil this weekend is most likely... juggling so many projects that demand my attention, during the week I can usually only manage a few hours at a time, which wouldn't be enough to polish this off.

@timmywil
Copy link

timmywil commented May 1, 2013

gotcha, thanks!

@nikmartin
Copy link

process.env.NODE_TLS_REJECT_UNAUTHORIZED=0 tells node/tls to skip certificate check
EDIT: It uses the certificate, it just ignores the fact that it doesnt match - the traffic is SSL encrypted.

@domenic
Copy link
Contributor

domenic commented May 5, 2013

72e0aa0 contains my latest work on this. It's pretty much done and seems to work well, judging by all the tests that pass. You can explicitly pass in style: "path" as an option on client creation and get path style URLs.

I haven't done auto-switching yet, but am leaning toward doing so. It would cover a few cases

I'd use the code from https://github.com/aws/aws-sdk-js/blob/master/lib/services/s3.js#L106-L136 most likely

@domenic
Copy link
Contributor

domenic commented May 5, 2013

Oh, right, and on timeline, for those waiting patiently: I'll try to implement the auto-switching late tonight, after dinner.

@domenic domenic closed this as completed in 72e0aa0 May 6, 2013
@domenic
Copy link
Contributor

domenic commented May 6, 2013

Knox 0.8.0 will try to automatically use path style if it sees a non-DNS compliant bucket name. Let me know how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants