Cucumber disable proxy and use direct connection - selenium

I am trying to write a cucumber test which uses Watir Webdriver and selenium with the Headless gem.
I get the error:
Timeout::Error: Timeout::Error
from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill'
When trying to open a page on a hostname that is mapped to a local connection (custom hostname mapped to 127.0.0.1) which is then set up as a virtual server in Apache.
I have a default system proxy which needs to be avoided for this connection because it should not use the proxy for local connections. I have already added the ignore proxy host to my ubuntu configuration.
How can I tell my Watir firefox profile NOT to use a proxy and instead direct connection. Or, how can I tell the profile to ignore the proxy for the custom hostname?
Everywhere in the documentation just mentions setting up a proxy, not how to disable it or how to ignore hosts in it.
The code I have is:
require 'watir-webdriver'
require 'headless'
Headless.new.start
b = Watir::Browser.new
b.goto 'http://gi-local'
Which then times out on the goto.
I have also tried adding:
profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.no_proxies_for']='localhost, 127.0.0.1, gi-local'
b = Watir::Browser.new :firefox, :profile => profile
b.goto 'http://gi-local'
But this still times out.

Solved. Needed to set all the proxy settings, not just the no_proxies part and also make sure to use numbers for ports instead of strings.

Related

Can't use URLs mapped in /etc/hosts for Webdriver.io

I'm using webdriver for my integration tests. I want to run the test suite for the url:
https://test.url.net
but I have some constraints that are beyond my control.
I need to run the tests on my local environment.
I cannot use localhost as my url
I solved this by adding an entry in /etc/hosts/ to map localhost to my url
$ cat /etc/hosts
127.0.0.1 test.url.net
when I run webdriver targeting https://test.url.net it just hangs and cannot connect, however, when I try to target https://localhost:443/ the test opens (and fails due to the constraint that we can't use localhost as a domain).
Is there a way to provide webdriver with a mapping of url to ip address?
https://test.url.net is directing only 127.0.0.1 / localhost. But you have to mention the port number.
try https://test.url.net:443 in browser manually and check if the website loads.
if yes then use this url with port number in webdriver.io

Alfresco Share login error behind reverse proxy

I configure my Alfresco instance to be in a sub-URI (www.example.com/prefix/alfresco , www.example.com/prefix/alfresco/share) and all looks to be fine except that I can't log in Shared. The Catalina.out log this error:
ERROR [alfresco.web.site] [http-apr-28080-exec-10]
javax.servlet.ServletException: Possible CSRF attack noted when
asserting referer header
'http://www.example.com/prefix/alfresco/share/page/'. Request: POST
/prefix/alfresco/share/page/dologin, FAILED TEST: Assert referer POST
/prefix/alfresco/share/page/dologin :: referer:
'http://www.example.com/prefix/alfresco/share/page/' vs server &
context: http://10.140.8.144/ (string) or (regexp)
Then the browser show me this page (www.example.com/prefix/alfresco/share/dologin):
Something's wrong with this page...
We may have hit an error or something might have been removed or
deleted, so check that the URL is correct.
Alternatively you might not have permission to view the page (it could
be on a private site) or there could have been an internal error. Try
checking with your Alfresco administrator.
If you're trying to get to your home page and it's no longer available
you should change it by clicking your name on the Alfresco toolbar.
I tried to deactivate the CSRF filter in share-config-custom.xml, but then I can't log and I don't have any message in the log, the login page show:
Your authentication details have not been recognized or Alfresco may
not be available at this time.
My apache conf:
ProxyPass /prefix/alfresco
http://10.140.8.144:28080/prefix/alfresco ProxyPassReverse
/prefix/alfresco http://10.140.8.144:28080/prefix/alfresco
ProxyPass /prefix/alfresco/share
http://10.140.8.144:28080/prefix/share ProxyPassReverse
/prefix/alfresco/share http://10.140.8.144:28080/prefix/share
I could log before configure Alfresco for work in the reverse proxy.
There is no need to deactivate the CSRF filter. If you changed the context path as described in the documentation you need to make sure that the tomcat connector "knows" the outside context (hostname, port, context).
Either
set proxyName and proxyPort
set RemoteIpValve in tomcat server.xml and set required proxy header
variables in apache (x-forwarded-for, x-forwarded-by,
x-forwarded-proto)
use proxy_ajp instead of proxy_http and define a ajp connector in
tomcat

Cannot install Wordpress Multisite (Network) on a custom port

I'm running a website at http://localhost:8080/sitename. However, when I'm trying to create a network of sites with wordpress, I'm getting the following error under Tools-> Network:
ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080.
I tried to create a virtual host and a fake domain but I can't make it work.
How can I solve that?
At this moment, Wordpress only seem to support 80 and 443 ports. A temporary possible workaround to use any custom (i.e. http 8080) port:
Open wp-admin/includes/network.php and find the section of code where it mentions array( ':80', ':443' ) and add :8080 too in that array.
After completing setup of network, you might need in wp-config to adjust to such:
define( 'DOMAIN_CURRENT_SITE', 'example.com'. (stristr($_SERVER['PHP_SELF'],'wp-login.php') ? '':':8080') );
As noted in comments (thanks) after creating first sub-site, it might have port number embedded in domain name, so try to enter Mysql Database (i.e. try hosting's phpMyAdmin, or even installed plugin before starting procedure) and in _blogs & _site& _options tables, to adjust homepage urls of subsites(i.e. separate port number from domain).
That's all. Login again to your project.
From my experience, WP is not designed to use custom ports for multi-sites so the blogs (sub-sites) hosts get messed up in the DB.
My solution: After you switch to multi-site or create a new site, you need to go to your db admin page (e.g. phpMyAdmin) and fix the blogs domain in the wp_blogs table. Basically WP failed to add a colon between the host and port; just have to add it-> localhost8080 becomes localhost:8080.
So, on the site's settings add the missing colon to the siteurl and home urls.
I found temporary solution:
running "netstat -o -n -a | findstr 0.0.80" in CMD will show you wich service is using the port 80. If PID is 4 it means that port 80 is used by the system (propably IIS or web matrix if it is installed - this was my case). i changed the port IIS was using from IIS Manager and i also deactivated MsDepSvc service (Web Matrix) which was also using port 80. After that i reconfigured apache to work in port 80 and everything worked OK!

SVN: remote access isn't working

I've installed subversion and apache on my pc. I can access to my repository using followinf url
http://localhost/svn/repos/
Now I want other members of my group to access the project files I've put in my repository. As it's my first time using svn I looked for the solutions and I think I'm a bit lost.
I read about port forwarding in my router so I opened my router interface. I went to NAT/PAT section of my router configuration and added a new rule with following caracteristics:
Application: svn
External port:3690
Internal port:80
protocol : TCP
equipment: myPC
And Checked the option "Active". But I think I'm missing something.
I read in an article that to verify if the remote access is working i have to go to
svn://83.200.108.71
While it doesn't work. "unable to connect.."
Can someone please help me .
Wait... You can access your repository via http://? Why not let others access the repository using http://?
Don't do anything with your router. Don't muck with ports. Apache httpd is serving your repository just fine off of Port 80. Tell your users to simply access your repository via http://<machineName>/svn/repos. That's all there is to it.
svn:// is a completely different protocol than http://. Port 3690 just happens to be the default port of svn://, but that doesn't mean if you reroute your http:// protocol there, everything will work.
Most of the time, people who first use Subversion set up the svnserve server instead of Apache httpd because it's easier than using Apache http. Here's how you setup a repository to use svn://:
$ svnadmin create my_repos #
$ vi my_repos/conf/svnserve.conf #Need to denop 'password-db=passwd' line
$ vi my_repos/conf/passwd #Need to setup user accounts
$ svnserve -r my_repos -d
And that's it. Now your users can access the repository via svn://<machineName>.
Although svnserve is simpler and easier than Apache (and faster), there are many reasons to use Apache httpd over svnserve:
Port 80 is likely not blocked by network while port 3690 maybe blocked
You can let Apache httpd use LDAP for authentication (which can also allow Windows Active Directory authentication)
Apache httpd can service multiple repositories while svnserve can only service a single repository on port 3690.

Openfire and strophe.js: not allowed by Access-Control-Allow-Origin

Im trying to create a webchat using Jabber. I have installed Openfire and i can login to the admin panel at :9090 so the server is running.
Now when using strophe.js basic example, coming with strophe.js i get this error:
5XMLHttpRequest cannot load http://jabber.xxx.dk:7070/http-bind/. Origin http://jabber.xxx.dk is not allowed by Access-Control-Allow-Origin.
How can i allow the domain?
Thanks to #SamGoody for pointing this out. As of version 3.8.0, OpenFire now supports1 CORS[2], which is needed for your use case. To enable it, go to the OpenFire admin console, Server, Server Settings, HTTP Binding tab. Ensure that "Provides support for CORS (Cross-Origin Resource Sharing)" is Enabled, with a domain list of * (these are the defaults).
If it doesn't work even after enabling CORS in Openfire and changing the domain policy to accept all, then check your URL for Openfire. You may need to add '/' at the end (e.g. 'http://dimain:7070/http-bind/').
Without the slash it didn't work for me.
Another option is to setup your apache server to proxy port 7070 so you're not dealing with cross-domain issues per se. The code for that looks something like this inside of your httpd.conf file:
ProxyRequests Off
ProxyPass /http-bind http://127.0.0.1:7070/http-bind/
ProxyPassReverse /http-bind http://127.0.0.1:7070/http-bind/
If you log in to the admin panel, go to the Server Settings tab, then to HTTP Bindings, check both options (HTTP Binding and Script Syntax) are set to Enabled
I had faced same issue and come to know that port was not open for access.
Though it browser says it is CORS Access-Control-Allow-Origin issue.
This is sometimes open port issue. Please make sure http bind port is open and can be accessible over tcp on system your are testing.