import os
cache.disk.folder = os.path.join('/home/minondoa/', 
'Appz/web2py/applications/Prueba/')
@cache.action(time_expire=21600, cache_model=cache.disk)
def index():
    #response.headers['Content-Type'] = None
    response.headers['Access-Control-Allow-Origin'] = 
request.env.http_origin
    response.headers['Access-Control-Allow-Origin'] = "*"
    response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"

El martes, 3 de mayo de 2016, 18:20:13 (UTC+2), Niphlod escribió:
>
> how are you serving the "cachefiles" ? web2py caches - at most - the 
> rendered view, not the headers ....
>
> On Tuesday, May 3, 2016 at 4:30:46 PM UTC+2, Antonio wrote:
>>
>> Hello again, 
>> I'm not really sure that I fomulated correctly the question, so sorry for 
>> that.
>> I'm using web2py to get some data with which to create a dictionary that 
>> I'll later use on a mobile app. The thing is that it takes a while to get 
>> all the information (which will stay the same for long periods of time) so 
>> I decided to create an application cache on disk.
>>
>> Before adding the cache everything worked fine. I just had to add 
>>     response.headers['Access-Control-Allow-Origin'] = 
>> request.env.http_origin
>>     response.headers['Access-Control-Allow-Origin'] = "*"
>>     response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"
>>
>> The problem is that once I added the cache, the first time I load the app 
>> it worked fine, but the second and the following times I get this error:
>> XMLHttpRequest cannot load 
>> http://127.0.0.1:8000/Prueba/gfs/index.json?latitude=43.4879176&longitude=-3.80055544.
>>  
>> No 'Access-Control-Allow-Origin' header is present on the requested 
>> resource. Origin 'http://localhost:8200 <http://localhost/>' is 
>> therefore not allowed access. 
>>
>>
>> Is there a way to add headers to the response when getting the 
>> information from the cache files?
>> Thanks in advance.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to