seleniumkit / gridrouter

Selenium-based solution to serve 1000+ browsers
Other
152 stars 36 forks source link

Jetty 403 Forbidden on fresh install #21

Closed kierr closed 8 years ago

kierr commented 8 years ago

I have attempted a fresh install on numerous Ubuntu trusty servers but no matter what I try, I get a 403 or 404.

Testing in both curl and firefox, on a clean installation with default config (I did initially try custom):

http://test:test@localhost:4444/wd/hub - 404 http://test:test@localhost:4444/ - 403

Firefox also complains that neither URLs require authentication. So clearly something is awry.


# cat users.properties 
test:test, user

# cat application.properties 
grid.config.quota.directory=classpath:quota
grid.config.quota.hotReload=true

# cat jetty.xml 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">
   <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.security.HashLoginService">
                <Set name="name">Selenium Grid Router</Set>
                <Set name="config">/etc/grid-router/users.properties</Set>
                <Set name="hotReload">true</Set>
            </New>
        </Arg>
    </Call>
</Configure>

 # cat /var/log/grid-router/grid-router.log 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
2016-02-11 13:23:17.811:INFO::main: Logging initialized @612ms
2016-02-11 13:23:17.867:INFO:oejr.Runner:main: Runner
2016-02-11 13:23:18.452:INFO:oejs.Server:main: jetty-9.3.3.v20150827
2016-02-11 13:23:25.777:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
2016-02-11 13:23:26.057:INFO:/:main: Initializing Spring root WebApplicationContext
2016-02-11 13:23:26,060 [main      ] INFO  ContextLoader        - Root WebApplicationContext: initialization started
2016-02-11 13:23:26,307 [main      ] INFO  ebApplicationContext - Refreshing Root WebApplicationContext: startup date [Thu Feb 11 13:23:26 GMT+07:00 2016]; root of context hierarchy
2016-02-11 13:23:26,456 [main      ] INFO  BeanDefinitionReader - Loading XML bean definitions from file [/tmp/jetty-0.0.0.0-4444-grid-router-deb.war-_-any-7643648958111754567.dir/webapp/WEB-INF/classes/META-INF/spring/application-context.xml]
2016-02-11 13:23:27,373 [main      ] INFO  laceholderConfigurer - Loading properties file from class path resource [application.properties]
2016-02-11 13:23:27,750 [main      ] INFO  ConfigRepository     - Loading quota configuration file [/etc/grid-router/quota/test.xml]
2016-02-11 13:23:28,018 [main      ] INFO  ConfigRepository     - Loaded quota configuration for [test] from [/etc/grid-router/quota/test.xml]: 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:browsers xmlns:ns2="urn:config.gridrouter.qatools.ru">
    <browser name="firefox" defaultVersion="33.0">
        <version number="33.0">
            <region name="us-west">
                <host name="my-firefox33-host-1.example.com" port="4444" count="5"/>
            </region>
            <region name="us-east">
                <host name="my-firefox33-host-2.example.com" port="4444" count="5"/>
            </region>
        </version>
        <version number="38.0">
            <region name="us-west">
                <host name="my-firefox38-host-1.example.com" port="4444" count="4"/>
                <host name="my-firefox38-host-2.example.com" port="4444" count="4"/>
            </region>
            <region name="us-east">
                <host name="my-firefox38-host-3.example.com" port="4444" count="4"/>
            </region>
        </version>
    </browser>
    <browser name="chrome" defaultVersion="42.0">
        <version number="42.0">
            <region name="us-west">
                <host name="my-chrome42-host-1.example.com" port="4444" count="1"/>
            </region>
            <region name="us-east">
                <host name="my-chrome42-host-2.example.com" port="4444" count="4"/>
                <host name="my-chrome42-host-3.example.com" port="4444" count="3"/>
            </region>
        </version>
    </browser>
</ns2:browsers>

2016-02-11 13:23:28,026 [1-thread-1] INFO  FileWatcher          - Watching for changes in directory /etc/grid-router/quota
2016-02-11 13:23:28,097 [main      ] INFO  ContextLoader        - Root WebApplicationContext: initialization completed in 2036 ms
2016-02-11 13:23:28.202:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@5479e3f{/,file:///tmp/jetty-0.0.0.0-4444-grid-router-deb.war-_-any-7643648958111754567.dir/webapp/,AVAILABLE}{file:///usr/share/grid-router/grid-router-deb.war}
2016-02-11 13:23:28.253:INFO:oejs.ServerConnector:main: Started ServerConnector@2ab4bc72{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2016-02-11 13:23:28.255:INFO:oejs.Server:main: Started @11064ms
kierr commented 8 years ago

I can however access http://localhost:4444/stats just fine. Which has me even more confused.

Is 403/404 returned if no nodes can be found? Surely it isn't that simple, given I'm not being authenticated as expected?

`` $ java -version java version "1.8.0_51" Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

innokenty commented 8 years ago

I think pure /wd/hub is not expected to reply 200. If you're able to access /stats then it should be working. Try requesting a browser on this instance, as if you're running it on one of your hubs.

innokenty commented 8 years ago

You can also try /ping, but there's zero chance it will fail. Because /stats is ok. Just FYI.

aandryashin commented 8 years ago

Hello,

try to create browser's session using curl and see if it fails

$ curl -u test:test http://localhost:4444/wd/hub/session -d'{"desiredCapabilities": "browserName":"firefox"}}'

levsha932 commented 8 years ago

Gridrouter doesn't have web front as selenium hub has. We have plans to implement it in the future

kierr commented 8 years ago

I see! Thank you guys for the quick responses, and for this very useful asset of a tool.

@aandryashin, your curl example was missing a { but as below, I see everything is working just fine.

curl -u test:test http://localhost:4444/wd/hub/session -d'{"desiredCapabilities": {"browserName":"firefox"}}'

Now, with a little luck, the magic can start happening, and my frustration of juggling hubs is over. Thanks again!