CORS and Sphinx

I am trying to implement Sphinx on my app and I am getting a CORS error

Access to XMLHttpRequest at '' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I have added the CORS Middleware to my TSphinxServer and set Origin to *.

Any ideas?

That should do it. What do you see in the browser network tab in developer tools? You can see the response headers of the request there, do you see the Access-Control-Allow-Origin header there?

No, that header is not there

Request URL:
Request Method: GET
Status Code: 503 Service Unavailable
Referrer Policy: strict-origin-when-cross-origin
Connection: close
Content-Length: 326
Content-Type: text/html; charset=us-ascii
Date: Thu, 13 Apr 2023 12:57:14 GMT
Server: Microsoft-HTTPAPI/2.0
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en;q=0.9,en-US;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Origin: http://localhost:8000
Pragma: no-cache
Referer: http://localhost:8000/
sec-ch-ua: "Chromium";v="112", "Microsoft Edge";v="112", "Not:A-Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 Edg/112.0.1722.39

You can see that status code is 503, so the request is not reaching the server. Your URL seems to be wrong, or your server is not up and running.

my mistake. I had 2 dispatchers on the datamodule and I was starting the wrong one.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.