w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Amazon Elastic Load Balancer (ELB) url not resolved by instance attached to it
This is normal, if I correctly understand your testing framework. The way that ELB is scaling, it starts out running on a very small machine, and as traffic increases, it's directed to even larger and larger machines. However, ELB is not configured to handle flash traffic, especially from a small number of hosts, as is the case with a load testing scenario. This is because the DNS record is changed whenever ELB scales, and it sometimes takes a while to propagate. Load testing frameworks sometimes cache the DNS lookup, making things even slower. The official ELB documentation (http://aws.amazon.com/articles/1636185810492479) states that traffic should not be increased by more than 50% every 5 minutes. I found that scaling takes even longer if you're looking to get over 150-200k RPM.

Categories : Wcf

Amazon web service load balancer unable to balance the load equally
There could be a number of reasons for this. Its without doing more digging, its hard to know which one you are experiencing. Sticky sessions can result in instances traffic becoming unbalanced. Although this depends heavily on usage patterns and your application. Cached DNS resolution. Part of how the ELB works is to direct traffic round robin on a DNS level. If a large number of users are all using the same DNS system provided by an ISP, they might all get sent to the same zone. Couple this with sticky sessions and you will end up with a bunch of traffic that will never switch. Using Route 53 with ALIAS records may reduce this somewhat. If you can't get the ELB to balance your traffic better, you can set up something similar with vanish cache or other software load balancer. Not as c

Categories : Amazon

Can I use Amazon ELB instead of nginx as load balancer for my Node.Js app?
Yes, but there are a few gotcha to keep in mind: If you have a single server, ensure you don't return anything except 200 to the page that ELB uses to check health. We had a 301 from our non-www to www site, and that made ELB not send anything to our server because of it. You'll get the ELB's IP instead of the client's in your logs. There is an ngx_real_ip module, but it takes from config hacking to get it to work.

Categories : Node Js

Why am I getting a 502 bad gateway when sending a redirect from behind amazon elastic load balancer?
It turns out that ELB is very picky about what it considers a 'valid' response and will return 502 Bad Gateway if it isn't happy. I fixed it by making sure the response from my server had the following headers: eg. if I was listening at http://example.com I send back the following response: HTTP/1.1 301 Moved Permanently Content-Type: */*; charset="UTF-8" Location: https://example.com/ Content-Length: 0 This makes ELB happy and everything works. For interest, here's the code (Java, using Simpleframework): private static void startHttpsRedirector() throws IOException { org.simpleframework.http.core.Container container = new org.simpleframework.http.core.Container() { @Override public void handle(Request request, Response response) { Path path = reques

Categories : Http

How to simulate Amazon's 60 sec timeout on Elastic Load Balancer (ELB) on a local xAMP environment?
This timeout has to do with a request taking more than 60 seconds, without sending any data as a response. Long HTTP requests like this should really be avoided. Even browsers may give up if they dont receive any response within a timeout period. If you can't get rid of long HTTP requests and you need to simulate it. You can use an fcgi/php-fpm configuration of php and provide a timeout of 60 seconds for which the fcgi process will wait for PHP to respond.

Categories : Apache

how to configure Elastic Beanstalk to deploy code to an instance but not add it to the load balancer
For the most part, though not straight forward, you could provide a .config file in .ebextensions to run your script files. This example of speeding up a deploy shows running some scripts and moving data back and forth. Better yet, the author describes the sequence and deployment process. I'm just embarking on this type of container customization. I have read of others dropping files in the /opt/elasticbeanstalk/hooks/appdeploy/pre and /opt/elasticbeanstalk/hooks/appdeploy/post directories, much of which can be derived by reading the post linked above. Also note that you can include the content of a script in the yaml .config file such as this which I found yesterday: files: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh": mode: "000755" owner: root

Categories : Ruby On Rails

How to force to download a file than view inside the browser depending on the user agent via .htaccess?
If you want to force download for specific file extensions, the easiest way is using AddType which is a mod_mime directive. For pdf, you can add this line to your .htaccess file: AddType application/octet-stream .pdf The key is octet-stream, this is the guy forcing download (and disallowing "Open..." items in download popups for browsers). Hope this helps! EDIT (asker's request in comment) As I got to go I try to give as much details as possible. If you mean to add a user agent 'prevention' you need these lines: RewriteCond %{HTTP_USER_AGENT} ^UserAgentNameHere [OR] (...more user agents...then last one:....) RewriteCond %{HTTP_USER_AGENT} ^AnotherUserAgentsName RewriteRule ^.* - [F,L] If you mean e.g. "forcing download for different browsers only", you need Apache Server v2.4 as you

Categories : Htaccess

Load different .css basing on user-agent - GWT project
I am using mgwt for creating mobile gwt apps. There is a themeing based on user agent: https://code.google.com/p/mgwt/source/browse/src/main/java/com/googlecode/mgwt/ui/client/theme/MGWTThemeBaseThemeStandardImpl.java In your Bundle you can seperate different css. If you don't use CssResources you may just use the StyleInjector

Categories : CSS

mysql on ec2 amazon instance attempting to login with incorrect user
Your can't call mysql_real_escape_string without having opened a connection with mysql_connect first. Quoting from the documentation: A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. The error message refers to your default username @ localhost because you haven't opened a connection with specific credentials yet - it doesn't know what account details to use.

Categories : Mysql

VB.NET WebBrowser Control Programmatically Filling Form After Changing User-Agent (Object reference not set to an instance of an object.)
Do you realize .All("btnK") returns a collection? So, you are doing .InvokeMember("click") on a Collection :). You cannot do that, you can only do .InvokeMember("click") on an element for obvious reasons! Try this: wb.Document.All("btnK").Item(0).InvokeMember("click") The .Item(0) returns the first element in the collection returned by .All("btnK"), and since there will only probably be one item returned, since there is only one on the page, you want to do the InvokeMember on the first item, being .Item(0). May I ask what it is you are developing? Since you're a new user, please up-vote and/or accept if this answered your question.

Categories : Vb.Net

Camel and load balancer
If you need to have that setup so that each server might receive the same record - then you need an idempotent route. And you need to make sure your idempotent repository is the same between your machines. Using a database as the repository is an easy option. If you do not have a database, a hazelcast repo might be an option. What can be an issue is to determine what is unique in your records - such as an order number or customer + date/time or some increasing transaction ID number.

Categories : Apache

load balancer won't remove itself from dns
When I nslookup your domain I get app-lb-west-650828891.us-west-2.elb.amazonaws.com: DNS server handling your query: localhost DNS server's address: Non-authoritative answer: Name: codepen.io Address: It is possible that the DNS change just needed a little time to propagate.

Categories : Amazon

What to care about when using a load balancer?
The biggest issue that you are going to run into is going to be related to php sessions. By default php sessions maintain state with a single server. When you add the second server into the mix and start load balancing connections to both of them, then the PHP session will not be valid on the second server that gets hit. Load balancers like haproxy expect a "stateless" application. To make PHP stateless you will more than likely need to use a different mechanism for your sessions. If you do not/can not make your application stateless then you can configure HAProxy to do sticky sessions either off of cookies, or stick tables (source IP etc). The next thing that you will run into is that you will loose the original requestors IP address. This is because haproxy (the load balancer) termina

Categories : PHP

Using Laravel behind a load balancer
We use a load balancer where I work and I ran into similiar problems with accessing cPanel dashboards where the page would just reload every time I tried accessing a section and log me off as my IP address was changing to them. The solution was to find which port cPanel was using and configure the load balancer to bind that port to one WAN. Sorry, I am not familiar with laravel and if it just using port 80 then this might not be a solution.

Categories : PHP

WCF security with load balancer
The client and server binding will be different. The client binding will use username auth in eitehr message or transport level with transport security (ssl): <bindings> <basicHttpBinding> <binding name="NewBinding0"> <security mode="Message" /> </binding> </basicHttpBinding> </bindings> then the server config will use the same config but without the transport security. If you chose to use message security then check out WCF ClearUsernameBinding. If you use trasnport security (basic http) then set mode="TransportCredentialOnly".

Categories : Wcf

Configuring Apache Load Balancer
Make sure you follow the advice in section stickyness: ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid scolonpathdelim=On (not only for the /test directory) Furthermore, for the JBoss application server, you need to supply route=web1 / route=web2 etc. in the Apache config and furthermore jvmRoute="web1" in the JBoss configuration of the <Engine name="jboss.web"... element (the location depends on the JBoss version you are using, for v4.2 it is server/default/deploy/jboss-web.deployer/server.xml) See also this tutorial

Categories : Apache

aws elastic load balancer not distributing
You need to have the route53 domain direct traffic to the ELB. If you have example.com and are trying to route that to the load balancer you need to associate the apex with the load balancer. To do this, go to the route53 tab. Click your hosted zone and go to record sets. then create a new zone and click yes for alias You then need to associate the hosted zone with your ELB. Now to get the traffic to fail over correctly you need to be running both instances behind the load balancer (preferably in multiple availability zones) and the ELB will take care of the failover. To do this, go to the elb section of ec2. Click your load balancer and add instances to it.

Categories : Amazon

Load Balancer between 5 network cards
There are several ways to do this and are all relatively easy. A VERY simple solution is to simply bind mssql to all 5 interfaces and give all interfaces a different network address. You can then configure some clients to point to one interface, others to the next etc. Depending on your network infrastructure you can also "bond" your network interfaces together so that they act like 1 interface on the OS. If you have a single switch and all of the interfaces are plugged into the single switch then bonding is an option. If they are plugged into two different switches then your switches will have to support lacp or something similar. You can also look at using a load balancer infront of your sql server. This could be problematic depending on your database, replication, sticky sessions etc.

Categories : Sql Server

AWS : S3FS AMI and load balancer high I/O Issue
I would like to recommend to take a look at the new project RioFS (Userspace S3 filesystem): https://github.com/skoobe/riofs. This project is “s3fs” alternative, the main advantages comparing to “s3fs” are: simplicity, the speed of operations and bugs-free code. Currently the project is in the “testing” state, but it's been running on several high-loaded fileservers for quite some time. We are seeking for more people to join our project and help with the testing. From our side we offer quick bugs fix and will listen to your requests to add new features. Regarding your issue: I'm not quite sure how does S3FS works with cached files, but in our project we try to avoid performing additional I/O operation. Please give it a try and let me know how RioFS works for you !

Categories : Amazon

Setting a trace id in nginx load balancer
In our production environment we do have a custom module like this. It can generate a unique trace id and then it will be pushed into http headers which send to the upstream server. The upstream server will check if the certain field is set, it will get the value and write it to access_log, thus, we can trace the request. And I find an 3rd party module just looks the same: nginx-operationid, hope it is helpful.

Categories : Nginx

How to get the actual URL in case of load balancer proxy server
I'm assuming you are using mod proxy (mod_jk/mod_ajp preserves the proxy host) Retrieve the "X-Forwarded-Host" header from request, which is the original host requested by the client. See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Categories : Java

What method(s) do I use to configure/update an Elastic Load Balancer via Java?
My bad. Forgot to execute the requests against the ELB variable. The code below creates the health check and assigns the instances associated with the ELB. Hope this helps the next person asking this question. ConfigureHealthCheckResult healthResult = myELB.configureHealthCheck(healthCheckReq); RegisterInstancesWithLoadBalancerResult registerResult = myELB.registerInstancesWithLoadBalancer(regInst);

Categories : Java

Secure a specific page by client IP behind AWS Elastic Load Balancer
The client IP is actually being passed via header (X-Forwarded-For). This header may include other load balancer IPs in addition to the client IP. If you can configure filtering based on headers, you should be able to do what you are attempting to do.

Categories : Asp Net

How to make restfull service truely Highly Available with Hardware load balancer
70-80 servers is a very horizontally scaled implementation... good job! Better is a very relative term, hopefully one of these suggestions count as "better". Implement an intelligent health check for the application with the ability to adjust the health check while the application is running. What we do is have the health check start failing while the application is running just fine. This allows the load balancer to automatically take the system out of rotation. Our stop scripts query the load balancer to make sure that it is out of rotation and then shuts down normally which allows the existing connections to drain. Batch multiple groups of systems together. I am assuming that you have 70 servers to handle peak load. This means that you should be able to restart several at a time. A st

Categories : Rest

Running nginx infront of a unicorn or gunicorn under Elastic Load Balancer
In a word: yes. Amazon's ELB service is wonderful, but it is solely a load balancer. Running nginx on your own server gives you a locus of control and a place to do rewrites, redirects, compression, header munging, caching, and more. Furthermore it allows you to serve static files in the fastest possible way, rather than using a slot on your more heavyweight appserver.

Categories : Nginx

How to assign to workers a proxy that requires user name - password and a custom user agent?
Assign User Agent by Desired Capabilities dcap = dict(DesiredCapabilities.PHANTOMJS) dcap["phantomjs.page.settings.userAgent"] = ( "Your User Agent String here . . .") Found API Reference here for the proxy authorization. Add "--proxy-auth=username:password" to server_args. Like . . . service_args = [ '--proxy=xxx.xxx.xx.xxx:xxxx', '--proxy-auth=username:password', '--proxy-type=http', ] Then use both when starting the webdriver driver = webdriver.PhantomJS(desired_capabilities=dcap,service_args=service_args) This took care of all my issues. EDIT: Unable to reproduce solution. Only proxy is changed with above method. EDIT.02: Issue resolved. It was never a coding issue. A new proxy provider at the server level assigned a default UA that ov

Categories : Python

JProfiler: How to load agent library?
Got it to work. Problem was that the server machine uses 32-bit Java even if it's running 64-bit OS. I also had to download ia32-libs as I had missing dependencies as well. There was also no need to modify/add LD_LIBRARY_PATH and PATH.

Categories : Java

nginx as load balancer server out 404 page based on HTTP response from app server
Simply set the proxy_intercept_errors option to on and create an nginx error page for it. error_page 404 /404.html; proxy_intercept_errors on; To ensure that nginx will serve the static file from it’s document root you also have to specify the following: location /404.html { internal; } I'm assuming here that nginx is configured to talk with your app servers as proxy, because that is the usual way and your question does not mention any of this.

Categories : Nginx

java agent with jvmti load at runtime, unload from within
You can only inject (deploy) an agent either at start time of the JVM by passing the argument -agentlib:<agent-lib-name>=<options> or -agentpath:<path-to-agent>=<options>. The other way is through Java itself. This depends heavily on the JVM, for that reason it is out of JVMTI specification scope. For instance if there is the VirtualMachine class through the method loadAgentPath(agentPath, options). If you want to execute this from within the native JVMTI code you would need to do Bytecode instrumentation. I am not sure, similar to 1. you could run the Java unload method through Bytecode instrumentation. If dlclose() works I do not see a problem in doing that. As you see, you can pass data to the Java agent by using the options. Alternatively, if you want to pa

Categories : Java

Cant get Amazon EC2 instance work
You need to check the security group that is associated with the instance. Make sure that you open up port 80. Also make sure that apache is started, and configured to start on boot. If you're logged in, you should be able to use wget localhost to verify if apache is serving up pages.

Categories : Amazon

How to access Amazon AMI ec2 instance in GUI
Very brief answer. It is not amazon linux specific because I don't use it but should give you enough hints because it is Red Hat based AFAIK. Basically you need to install the GUI you want to use (xfce, gnome, kde, etc.) and vnc server. try yum search vnc and yum search gnome to find out what packages do you need to install. You then start vnc server on the machine. You do the above through command line console. If it works for you you may make VNC start with machine boot. I don't know which tutorial is good for putty port forwarding because not using windows but this looks promising to me: http://martybugs.net/smoothwall/puttyvnc.cgi With linux (perhaps if you install cygwin on your windows that will be possible for you as well) one usually can start a remote vnc session with automati

Categories : Linux

What is MATM in my User-agent
MATM is a codename for the hardware, one of several by the same vendor: useragent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; MATMJS) vendor: TS - useragent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; MATM) vendor: TS - useragent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/7.0; MATP) vendor: TS - useragent: Mozilla/5.0 (MSIE 9.0; Windows NT 6.3; WOW64; Trident/7.0; MATBJS; rv:11.0) like Gecko vendor: TS - useragent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; MATPJS; rv:11.0) like Gecko vendor: TS - useragent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; TNJB; rv:11.0) like Gecko vendor: TS - useragent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; Touch; TAJB; rv:11.0) like

Categories : Internet Explorer

Is it possible to specify user agent with URL in HTML?
Can the HTML DOM be modified to indicate that either a single or all URLs (<a href=""> elements) use a specific user agent? Not in any standard way. If it's possible to add a custom (non-standard) attribute to the element or possibly a child element to it, that'd work too, if it's valid to do so. "non-standard" is practically invalid by definition. There is a loophole in data- attributes (since they are defined by the specification as a way to add extensions) but: "These attributes are not intended for use by software that is independent of the site that uses the attributes" HTML 5 is a Candidate Recommendation, not a standard.

Categories : HTML

Interesting IOS 6 user agent
Ok basically if you install the Google Search App and visit a site via the app then the user agent will be Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_4 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B350 Hope this helps someone.

Categories : IOS

How do I set the user agent in Volley?
You should override the method getHeaders() in Request and set the "User-agent" header In your Request class: @Override public Map<String, String> getHeaders(){ Map<String, String> headers = new HashMap<String, String>(); headers.put("User-agent", "YOUR_USER_AGENT"); return headers; }

Categories : Android

What is my user.agent version?
For Firefox (Gecko) use <set-property name="user.agent" value="gecko1_8" /> But it depends of the GWT version. Other possible values are ie6, ie8, gecko1_8, safari, opera, ie9.

Categories : Gwt

In java, how can I get an Amazon EC2 Instance to see its own tags?
You should be able to get the current instance id by sending a request to: This only works within ec2. With this you can access quite a bit of information about the instance. However, tags do not appear to be included. You should be able to take the instance id along with the correct authentication to get the instance tags. If you are going to run this on an instance, you may want to provide an IAM user with limited access instead of a user which has access to everything in case the instance is compromised.

Categories : Java

Login Amazon instance with pem and password
You can use IAM groups and users. The documentation is here. IAM allows you to generate separate access keys for users with restricted usage rights.

Categories : Amazon

How to figure out the 'Public DNS Name' from within an Amazon EC2 instance?
Take a look here, but use public-hostname instead of instance-id.

Categories : Windows

Amazon AWS SDK PHP 2 - Filter tags by instance?
The API docs for Ec2Client.describeTags show that Value should actually be Values and should be an array. Try the following: $oModel = $oEC2Client->describeTags(array( "Filters" => array( array("Name" => "resource-id", "Values" => array($sInstanceId)) ) ))->toArray();

Categories : PHP

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.