NetTalk Central
Toggle navigation
Login
Register
×
Welcome,Guest
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
NetTalk Central
»
NetTalk Web Server
»
Web Server - Ask For Help
»
Access-Control-Allow-Origin
« previous
next »
Print
Pages: [
1
]
Author
Topic: Access-Control-Allow-Origin (Read 3718 times)
Thys
Sr. Member
Posts: 311
Access-Control-Allow-Origin
«
on:
February 06, 2017, 07:14:11 AM »
Hi,
I'm using a page script in Firefox to do a file upload to a NT web service method. The file is successfully uploaded, but the browser's console then returns an error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at
http://127.0.0.1:8080/UploadFile?FileExtension=PDF
. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
Because the file is successfully uploaded, the only reason I can think of for this error, is that the response might be missing information. I started reading about
Access-Control-Allow-Origin
, which is a response header used for cross-origin HTTP requests. Is there something in the NT web service that I can change to get this working?
Thys
Logged
Bruce
Global Moderator
Hero Member
Posts: 11244
Re: Access-Control-Allow-Origin
«
Reply #1 on:
February 07, 2017, 12:32:55 AM »
Hi Thys,
There is a header you can set in the reply.
Probably the easiest way for you is in the WebServer procedure.
add
s_web._SitesQueue.Defaults.AccessControlAllowOrigin = '*'
just before the line
Put(s_web._SitesQueue)
Cheers
Bruce
Logged
Thys
Sr. Member
Posts: 311
Re: Access-Control-Allow-Origin
«
Reply #2 on:
February 07, 2017, 02:22:40 AM »
Bruce.
The code should actually be:
s_web.HeaderDetails.AccessControlAllowOrigin = '*'
Firefox now accepts the response. I'm sure that Chrome and Edge should as well.
Thanks
Thys
Logged
Print
Pages: [
1
]
« previous
next »
NetTalk Central
»
NetTalk Web Server
»
Web Server - Ask For Help
»
Access-Control-Allow-Origin