How to disable CORS or set Access-Control-Allow-Originin Selenium Grid hub

934 views
Skip to first unread message

Long Nguyen

unread,
Sep 4, 2019, 1:35:29 PM9/4/19
to Selenium Users
✒️ Reproduce

When I call Selenium Hub from browser, it didn't allow client connect to hub server because of CORS policy.

Access to fetch at 'http://localhost:4444/wd/hub/session' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

🌻Detail

I made Selenium Grid hub server with nodes are Appium Server. I called Appium server through Hub Server (http://localhost:4444/wd/hub) from browser.
It's already worked well when called from client. It means my grid have no problems. When I call directly to Appium Server with allow CORS parameter (--allow-cors), it worked without CORS error.

So, I think that when I start Selenium Hub I should setup in order to allow my origin. Or just disable CORS as Appium Server worked with --allow-cors parameter.

💬 Questions

So, how to disable CORS or set Access-Control-Allow-Origin when I start a Grid hub or Docker-Selenium-Hub through parameter?

Thanks a lot (bow)

Reply all
Reply to author
Forward
0 new messages