rejetto forum

CORS header - can't get this to work

0 Members and 1 Guest are viewing this topic.

Offline kabutzal

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
I need to have all files from HFS served with CORS (Access-Control-Allow-Origin header).
Unfortunately, I don't understand much about HFS macros and templates.

I tried implementing the solution given here with no luck:
http://www.rejetto.com/forum/html-templates/cors-header-and-simple-template-for-javascript-driven-access/

Can someone please explain in detail how to do this?

Thanks


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 901
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
okay, that one of mayny post redirefts

so yo have to have a javaspcipot, or some html / macor coding with HFS to send and receve dat via the headder....

so the post that you posted goes over covering a few issue (assuming you already have the JavaScript code to download and upload! (that was never shared int eh post!

what was shared was the issue / fix for that person:

http://www.rejetto.com/forum/html-templates/cors-header-and-simple-template-for-javascript-driven-access/msg1058937/#msg1058937
Code: [Select]
Add {.add header | Access-Control-Allow-Origin: * .} to template works for templateswhich orginaly is not in HFS.... os it was added to HFS....

the post later went on to go to a template that had those requests " XMLHttpRequest(GET ... ). / XMLHttpRequest(PUT ...)
http://www.rejetto.com/forum/italiano/template-vista-con-chat-e-video-player-italiano-vers-1-8-new/?action=dlattach;attach=7846

which has how the code can work.....

Now that rases the question??? - what did you " I tried implementing" ?
What do you need help with?

what are you trying to do?...
Files i try to keep and share can be found on my google drive:

https://drive.google.com/drive/folders/1FOWi3Gqaldld6JLXvZ-biDv4RSguf0IC


Offline kabutzal

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
I have a few files sitting in HFS's virtual file system.
When a browser tries to access/download these files, I need HFS to include the CORS headers in the response.

Here are the instructions for various server types:
http://enable-cors.org/server.html

HFS is not there.

Is this possible?


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 901
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
form the forum post and the link you have sent me, to my understanding, it is possible....

http://www.html5rocks.com/en/tutorials/cors/

You need to add this to hfs header!...

so right click properties "/" the house in HFS
Different template tab

add this line:
Code: [Select]
{.add header | Access-Control-Allow-Origin: * .}
derived form the other forum post adn your site:

http://enable-cors.org/server_php.html
http://enable-cors.org/server_perl.html
Files i try to keep and share can be found on my google drive:

https://drive.google.com/drive/folders/1FOWi3Gqaldld6JLXvZ-biDv4RSguf0IC



Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13294
    • View Profile
i would try events instead changing the template
Menu > other options > edit event scripts
then put this
Code: [Select]
[download]
{.add header | Access-Control-Allow-Origin: * .}


Offline surikat

  • Occasional poster
  • *
    • Posts: 66
    • View Profile
i would try events instead changing the template
Menu > other options > edit event scripts
then put this
Code: [Select]
[download]
{.add header | Access-Control-Allow-Origin: * .}

It does not work for me. Requests to save a text file .txt Where to save it?


Offline surikat

  • Occasional poster
  • *
    • Posts: 66
    • View Profile
form the forum post and the link you have sent me, to my understanding, it is possible....

http://www.html5rocks.com/en/tutorials/cors/

You need to add this to hfs header!...

so right click properties "/" the house in HFS
Different template tab

add this line:
Code: [Select]
{.add header | Access-Control-Allow-Origin: * .}
derived form the other forum post adn your site:

http://enable-cors.org/server_php.html
http://enable-cors.org/server_perl.html

Also the error repeats. Maybe because I take the file through the port and I need to specify the address of the type:

Code: [Select]
{.add header | Access-Control-Allow-Origin: site.com:port .}   ?


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 901
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
i would try events instead changing the template
Menu > other options > edit event scripts
then put this
Code: [Select]
[download]
{.add header | Access-Control-Allow-Origin: * .}

More of a question for rejeto. (As I wouldn't know how to tell the full coros hand shake and see it. I'd wore shark the packet to see the header.

As long as you followed rejeto instructions this should.be working g on the stable build
Files i try to keep and share can be found on my google drive:

https://drive.google.com/drive/folders/1FOWi3Gqaldld6JLXvZ-biDv4RSguf0IC