NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Thys 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
-
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
-
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