Custom headers are not working in Amazon EC2 server - ruby-on-rails

We are building an API and using Rest Console extension of Chrome for testing purpose. We have deployed our Application on Heroku server for debugging and on EC2 server as well. It is giving correct results on Heroku server with Custom headers. But for EC2 server, the custom headers are not passing. Because of which the correct results are not displayed on the EC2 server. While checking the EC2 server log file we found that the custom headers does not exist in HTTP Header.
From Local system we are requesting using Restclient:
RestClient.get('http://ec2-54-225-122-111.compute-1.amazonaws.com/method_name',{"Authorization"=> authorization_element,"custom_header1"=>val1,"custom_header2"=>val2})
Is there any settings we need to do in order to get custom HTTP Header in Amazon AWS server?
EDIT: I'm using EngineYard for deployment process.

I got the solution by passing the names without underscore.
I was passing the custom header with name having underscore like custom_header1="some value".
And from here, I come to know that underscore is not allowed although hyphen is allowed which is further converted into underscore.

Related

How to configure Neo4j Browser to use a custom REST endpoint?

The server is running a custom REST endpoint configured using the following line
org.neo4j.server.webadmin.data.uri=/db/abc
in neo4j-server.properties. REST is then working fine using /db/abc, but then the browser client (http://$SERVERHOST:7474/browser) stops working and displays the Disconnected from Neo4j message. Packet sniffing indicates it is still trying to connect to db/data. Clearing local web caches doesn't help. Is there a way to point the browser client to use a custom endpoint?
Sources indicate that /db/data is possibly hardcoded into the browser as part of client "Settings" (see line 23). There is supposedly a way to reconfigure these settings using the :config command in the client, but the command bar is only available when the client is already connected to the server.
Is there a way to get this to work, or is it possibly a bug in the browser client?
Current option is to download source code of the browser and change what you need.
https://github.com/neo4j/neo4j/tree/2.3/community/browser

Cloud9 ajax call between two workspaces

I am tring to set up my Cloud9 workspace to work on a rails api projet. The repo contain 2 projects, the rails json api and the front (angular app).
As cloud9 does not provide two external ports, i cannot run them both on the same workspace.
I created 2 differents workspaces, one running the rails api and the other running the angular app (served by a small node process).
Everything is fine except that when i try to call the api (ajax call => $http), i get a cross origin request warning.
XMLHttpRequest cannot load https://workspace-user.c9.io/. The request was redirected to 'https://c9.io/api/nc/auth?response_type=token&client_id=proxy&redirect=http%3A%2F%2Fworkspace-user.c9.io%2F', which is disallowed for cross-origin requests that require preflight.
How can i prevent that?
Thank you
ps: The real url is not workspace-user, i did change it.
Lets say your domains are:
https://ws1-user.c9.io (page which performs ajax is located here)
https://ws2-user.c9.io (destination url)
In ws2-user.c9.io open the terminal and write:
sudo vim /etc/apache2/sites-enabled/001-cloud9.conf
add the following line:
Header set Access-Control-Allow-Origin "https://ws1-user.c9.io"
In the terminal write:
sudo a2enmod headers
service apache2 restart
It should work now.
You can specify which sites are allowed to connect using special CORS headers. For more information see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

OpenESB - different environments

I am developing a service layer app which provides a catalog of webservices, then I am orchestrating them using OpenESB.
I create my BPELs importing external WSDL definitions using http://localhost:8080/services/myService?wsdl.
The problem is -- these BPELs strongly depend on this specific URL, and when I deploy on production server, my ESB layer stops working.
How can I make my BPELs independent of the specific endpoint? Can I refer the URIs to an external config file?
To do it you must create application configuration and application variable and add them on your http address. Example: "http://${MyHtttpAddress}:${MyHttpPort}/service1/myService?wsdl"/>.
Applications and variable are set up in the administrative console and can be changed for each environment.
Regards
Paul

How to debug client side dart code in Dart editor without CORS

I have a server / client project, both written in dart. Now my server starts on port 1337 and when I run my client with the Run in dartium, my static files are served on port 3030 which allows me to debug my client code in the Dart editor.
The problem is that this causes CORS when using AJAX calls. I have properly setup my server to accept other origins (with Access-Control-Allow-Origin) but, for example, cookies aren't sent along.
Now I'm wondering: is there a way to serve my files with my server (running on 1337) and still have the possibility to debug the client side code in the dart editor?
My understanding is that you can debug, but the real problem is that you don't get the expected data back from the server due to missing cookies.
Standard CORS requests do not send or set any cookies by default.
In order to include cookies as a part of the request, besides setting up the server, you need to specify withCredentials property, e.g.:
HttpRequest.getString(url, withCredentials:true)...
You will also need to setup server to provide Access-Control-Allow-Credentials header.
EDIT: it seems that additional issue is that you don't want to have 2 servers, each serving different part of app.
In that case, you can configure DartEditor to launch the URL, instead of files. Go to Run > Manage Launches and add create a new Dartium or Dart2JS launch with specified URL and source directory.
Another option is to select Run > Remote Connection and attach to a running instance of browser or Dart VM.
Caveat: I haven't tried these options, so I can't tell how stable they are.

Recaptcha error

I have a problem with Recaptcha gem. I'm using Ubuntu on a virtual machine (VirtualBox). It uses bridged network interface card, so I have internet access there and I can see this Ubuntu from my host computer.
When I run rails s and than go to
127.0.0.1:3000 on virtual machine everything is fine.
192.168.0.103:3000 on host machine there is an error with recaptcha box.
Input error: Invalid referer is where the box is supposed to be.
Why is it like that and how to fix this?
But, when we tried to host the same application to any server with the same pair of keys, it will not generate an error but, it will display like "input error - invalid referer" instead of captcha in your form.
Because, when we are getting the pair of keys from Google API, we will specify the domain name there. In that, to use those keys in your local system, we will enter domain as "localhost". But, these pair of keys will not work when we deploy that application in any server.
So, for the application to work in the remote host, we should get the pair of keys from Google API with the domain name, where we are going to deploy your application. And use them in your application.
Note:
We can have a new pair of keys for recaptcha using following link:
http://www.google.com/recaptcha/whyrecaptcha

Resources