The URL generatio for TinyMCE has an issue where it doesn't see that the 
URL should not be generated with the security token. I believe I did the 
following to fix it (I put it into my settings file then made sure that app 
was registered after mezzanine and django folder storages). 

If you are using django folder storages then you should be able to use this 
code exactly. If not, then FixedS3BotoStorage would have to be replaced by 
the class that generates the URL for your S3 folder. You may have written 
your own or gone directly with S3BotoStorage. 

This should do the trick for you. Please respond IF IT DOES. So that others 
find the answer.

from s3_folder_storage.s3 import FixedS3BotoStorage
import urllib
import urlparse
def url(self, name):
        orig = super(FixedS3BotoStorage, self).url(name)
        scheme, netloc, path, params, query, fragment = 
urlparse.urlparse(orig)
        params = urlparse.parse_qs(query)
        if 'x-amz-security-token' in params:
            del params['x-amz-security-token']
        query = urllib.urlencode(params)
        return urlparse.urlunparse((scheme, netloc, path, params, query, 
fragment))

FixedS3BotoStorage.url = url

On Friday, May 30, 2014 8:28:48 AM UTC-7, John Briere wrote:
>
> Ryan and Brad, thanks for your replies. Brad I'll need to use your 
> settings for making SSL work, thanks for that pointer.
>
> Ryan, the issue isn't if TinyMCE works or not, it's why TinyMCE only works 
> with AWS_QUERYSTIRNG_AUTH=False. I'm puzzled as to why TinyMCE is the only 
> thing that doesn't work when that setting is turned on. All the other 
> resources I have stored in AWS are reachable with the AuthString at the end 
> of the URL. But the AUTH string created for TinyMCE resources is wrong. 
> Which makes me think there's a bug somewhere that's using the wrong AWS 
> keys to generate the auth string just for TinyMCE, and I was wondering if 
> anyone had encountered this. 
>
>
>
>
> On Tue, May 27, 2014 at 4:14 PM, Ryan Sadwick <rsad...@gmail.com 
> <javascript:>> wrote:
>
>> Try these settings, there isn't much documentation on these.  My site 
>> runs on SSL and all the TinyMCE editors work.  I'm running Mezzanine 3.14 + 
>> Cartridge.
>>
>>
>> *STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'*
>> *AWS_QUERYSTRING_AUTH = False*
>> *AWS_S3_SECURE_URLS = True*
>>
>>  *AWS_S3_CUSTOM_DOMAIN = 's3.amazonaws.com/bucket_name 
>> <http://s3.amazonaws.com/bucket_name>'*
>> *S3_URL = 'https://s3.amazonaws.com/bucket_name 
>> <https://s3.amazonaws.com/bucket_name>'*
>> *MEDIA_URL = S3_URL*
>> *STATIC_URL = S3_URL*
>>
>>
>> On Friday, May 23, 2014 2:36:24 PM UTC-4, Brad Bode wrote:
>>>
>>> Although you are having a slightly different issue you might want to 
>>> join in on my discussion (with myself). It's a very similar problem. 
>>>
>>> https://groups.google.com/d/msg/mezzanine-users/A7wEDWprYZY/gb-FBYxJjzQJ
>>>
>>> I am using AWS S3 with SSL for the admin. The only problem I have left 
>>> is getting the source editor to work. I might be able to advise you on your 
>>> issue as well. You may first want to read the replys here:
>>>
>>> https://groups.google.com/d/msg/mezzanine-users/r5DXu0dkCMU/3eH4wdczaZcJ
>>>
>>> It relates to getting S3 working with mezzanine.
>>>
>>>
>>> On Tuesday, May 20, 2014 5:33:07 PM UTC-7, John Briere wrote:
>>>>
>>>> Hi all - I ran into a weird situation using a very basic S3 setup - 
>>>> this is without even trying to use the filebrowser with S3 which I know 
>>>> can 
>>>> be an issue.
>>>>
>>>> The basic problem is that when ever I go to an admin page that uses the 
>>>> tinymce JS files to render a rich text editor, I was getting a lot of 
>>>> 404/permission denied errors. Specifically the error was 
>>>> <Error>
>>>> <Code>SignatureDoesNotMatch</Code>
>>>> <Message>
>>>> The request signature we calculated does not match the signature you 
>>>> provided. Check your key and signing method.
>>>> </Message> 
>>>>
>>>>
>>>> where Django was referencing the tinymce JS files using a URL like this:
>>>> https://<mybucket>.s3.amazonaws.com/grappelli/
>>>> tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_
>>>> plugin.js?Signature=<some signature> &Expires=1400621225&
>>>> AWSAccessKeyId=<somekey>
>>>>
>>>> However, I've set my bucket to be completely public for reads so a URL 
>>>> like this works fine:
>>>> https://<mybucket>.s3.amazonaws.com/grappelli/
>>>> tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js
>>>>
>>>>
>>>> Now everything else works great - collect static, uploading an image 
>>>> (not using file browser, just using a regular image field) - and in the 
>>>> case of uploading an image, the AWS signature field is included and seems 
>>>> to work correctly. So only the admin JS files seem to be broken.
>>>>
>>>> The only thing that seems to get the tinymce JS files to view correctly 
>>>> is when I set 
>>>>
>>>> AWS_QUERYSTRING_AUTH = False
>>>>
>>>> in my settings file. 
>>>>
>>>> The only thing I can think is that grappelli is picking up the wrong 
>>>> AWS secrets when generating the link to the JS files. 
>>>>
>>>> Is there something very basic here I'm missing? 
>>>>
>>>> I've noticed a lot of the boto/storages examples that I see around the 
>>>> mezzanine forum have the query string auth turned off, but I'd like to 
>>>> understand the reasons behind this in case I want to roll out some 
>>>> cache-busting code later.
>>>>
>>>> thanks- John 
>>>>
>>>>
>>>>
>>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to