-
-
Notifications
You must be signed in to change notification settings - Fork 357
Post support as in http://aws.amazon.com/articles/1434 #28
base: master
Are you sure you want to change the base?
Conversation
+1, all that is needed is to enable CORS. This can be as simple as exposing a commandline flag EDIT: on a second thought, this might be slightly more complicated. It will need to accept any tokens sent to it and implement a similar interface. And What I was talking about above was direct upload to s3 using ajax. Similar to what Ryan Bates showed here: http://railscasts.com/episodes/383-uploading-to-amazon-s3 |
You can see what was needed to be implemented here: https://github.com/jubos/fake-s3/pull/28/files |
just tested it out and got: 'can't convert nil into String'. That is responding back to me after it attempts to send the file. Below are the sent headers:
Never the less, I think this is a great start :) |
The request looks fine on the first sight. I'm afk, so I will be able to look at it only in a week. We are actually using it for development of our application btw. |
Well I am sure it is something small. If there are any small debug steps you want me to try, I'll give it a shot. I also wanted to use it for development, right now I am using fake s3 90% of the way. The other 10% is initial upload to a temporary s3 bucket that gets cleared every two days. Follow the instructions on RailCasts with some modifications to achieve that. http://railscasts.com/episodes/383-uploading-to-amazon-s3 |
Try to add on line 203 in lib/server.rb (above response.status = 400) |
Took a few more debugging steps and discovered the bucket under |
Interesting. I don't think that I even modified anything related to this code. I think this is due to the way the bucket is deduced, especially when handling POST. |
It is totally because of that. Fakes3 uses a different structure than the real s3 with the bucket after the host name instead of the bucket being a subdomain (to avoid the whole /etc/hosts mess). The code that gets the bucket needs to be patched. So the path to my bucket is Looking at the code it is rather confusing and I am not sure why a GET request would go through different normalization than a POST request. That is where the problem comes from. |
Ok the following 5 lines need to be added at the end of if s_req.is_path_style
path = webrick_req.path
path_len = path.size
s_req.bucket = path[1,path_len].split("/")
end It seems to work quite well now :). If you can commit that @romanbsd that would be great. This is what my url method looks like (based on the railcast): def url
return "https://#{@options[:bucket]}.s3.amazonaws.com/" unless CONFIG[:download_from] == 'localhost'
# fakes3
return "http://#{CONFIG[:aws_s3_host]}:#{CONFIG[:aws_s3_port]}/#{@options[:bucket]}/"
end Hope this gets pull into the main branch soon. Very useful, thanks for the hard work @romanbsd. |
I should better refactor it, to DRY it up. |
I could really use this feature, any progress? |
You can use my fork: https://github.com/romanbsd/fake-s3.git , we've been successfully using it for almost a year now. |
Thanks, I'll try that. |
Hi, Could please help me with Access Key ID, because I'm trying to use Error:
|
The same problem like rahulinux has. How to setup keys for server? |
I think you need to add s3.amazonaws.com ( or like eu-bucket.s3.amazonaws.com ) to point to your fake s3 server IP |
rahulinux or ironmanby, how do we go around this issue? I've been stuck on it for a while now. Any fixes you could help me with that worked for you? |
Looking for some feedback. If it looks fine, then I can invest some time and write some tests.