Using org.mortbay.jetty.Server;
I initialized my Jetty server to port 8080 (in the xml ).
server = (Server) applicationContext.getBean("JettyServer");
I am sending HTTP messages (GET,PUT,HEAD) to my server on address: http://localhost:8080.
But instead of handling the requests like i defind with handlrs the server returns 404 "Server out-bound response".
What am i doin wrong?
Thanks.
Have you attached a handler to handle the requests ? See this as demonstrated at http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty - HelloHandler
you will also need to set a contextHandler - See Setting Contexts section in above link and you will need to hit that URL while querying it.
Related
I'm trying to deploy a solution using Open Trip Planner, and everything is OK if I use HTTP, but apparently the HTTPS connection doesn't work.
I've followed the official docs but with no success, apparently the internal server is running, it logs that the expected HTTPS port is listening and the port is actually shown as listening by the OS (Windows 10 Pro) but no secure connection can be established (I tried the "curl" and "open-ssl" tests in the page but both failed)
This is the document I refer to:
http://docs.opentripplanner.org/en/latest/Security/#security
Please any help is appreciated, thanks in advance
Is using a reverse proxy like nginx an option for you? That way nginx can handle the HTTPS requests, and then pass them onto opentripplanner.
Here's an example nginx configuration:
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/cacert.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
server_name opentripplanner.example.com;
proxy_pass http://127.0.0.1:8000;
}
References:
https://manual.seafile.com/deploy/https_with_nginx.html
https://nginx.org/en/docs/beginners_guide.html
I am supporting another vendors legacy application.
This is a J2EE application that runs on Glassfish v3.1.2.2. It has a REST API implemented using JAX-RS. I have limited visibility to the application and source.
The symptoms are:
make an HTTP request to a REST API
application has its own auditing system, this shows a successful request
no errors in GF logs
GF access log notes the request
0 bytes are returned from the request to the caller
This happens for both remote calls as well as from calls made using curl on localhost.
If we make the same requests to a different port over HTTPS they succeed. We are reluctant to move the calls to that other port without knowing a root cause. These failed intermittently last night and now fail constantly today.
A packet capture of the request shows:
- TCP overhead/handshake
- A GET request
- A single ACK from the application back to the caller
- then nothing after that
What would cause Glassfish v3 to successfully handle and process an HTTP request but return no data?
Is there a mechanism in Glassfish v3 to flush or reset an HTTP listener and its associated thread pool?
Since this happens on a curl request on the same server to localhost I think I can rule out the network being the issue.
The ports being used communicate directly with Glassfish. There is no proxy (like Apache or Nginx) between the caller and the app server.
Are there logging or monitoring settings I should be enabling in Glassfish to observe what the HTTP listener is doing relative to the application and the network stack?
I have obfuscated some examples that show the symptoms:
Glassfish Access log:
"0:0:0:0:0:0:0:1" "NULL-AUTH-USER" "25/Oct/2018:11:21:02 -0500" "GET /api/obfuscated/by/me HTTP/1.1" 200 9002
Curl response for that same call:
* Trying OFBBFUSCATED
* Connected to hostname.local (OFBBFUSCATED) port 11080 (#0)
> GET /api/obfuscated/by/me HTTP/1.1
> Host: hostname.local:11080
> User-Agent: curl/7.43.0
> Accept: */*
> Authorization: Basic asdfdsfsdfdsfsdafsdafsdafw==
>
* Empty reply from server
* Connection #0 to host hostname.local left intact
UPDATE I changed a timeout setting for the HTTP network listener. I bumped it from 30 to 35 seconds because I was seeing a packet capture where the app was sending a FIN after 30 seconds. After making this change it started to work again.
It is not clear if this somehow flushed or reset something or if I had some kind of race condition.
The apparent root cause was high I/O on the system running these services. The applications normally used 50MB/sec, a new process drove that usage to 250MB/sec. Once the I/O problem was resolved all of the HTTP errors went away and haven't come back.
I am new to developing client/server interfaces.
I have a client facing app which sends a GET request to server based on an action. I currently have this running on the localhost setup by apache. I created my own directory in /var/www and made changes to the config files.
I have a server running that I have written in Java. It is listening on port 8888. Now when I type http://localhost:8888 - my server crashes with a NumberFormatException For input string: "Host: localhost:8888"
What is it I need to do in order to run my client on the specific port? Why am I receiving a get request when I haven't sent anything?
I've tried searching for similar questions and made edits to the config files by changing the default port 80 to 8888 both in ports.conf and 000-default.conf followed by a restart. This however causes both localhost and localhost:8888 result in nothing.
It seems that your server is treating the HTTP headers wrong: when you enter http://localhost:8888 in your browser, you will receive (among other things) a header like this:
Host: localhost:8888
Apparently, you server is trying to convert this line into a number.
i have a question for you guys, do you know a way how can i send http request with jmeter to my soap webservice(jax-ws library)?. I have a problem to point server name or ip(its localhost so should it be loopback?) and path. I'm using glassfish4 as my web server. I do not want to use option SOAP/XML RPC Request, because when i use it with my web service i can't see that any data have been sent(it's always 0 -in fact maybe you have idea why is that...it's also a solution to my problem because i need http request to see how much data i've sent)
!https://postimg.org/image/mpbai5n1v/
Thanks in advance
Regards!
Use:
Http Request and fill in:
Server Name or IP
IP if different from 443 or 80
Protocol if https
Add a Header Manager under it with :
Content-Type=text/xml; charset=utf-8
Note there is a template that lets you easily create this, see screenshot:
Finally I suggest you read this tutorial:
http://jmeter.apache.org/usermanual/build-ws-test-plan.html
We have a JSF application , serving the requests via tomcat ajp protocol. The entire web site is sitting behind Cloudflare CDN. When the following code is executed
String ipaddress = httpServletRequest.getHeader(HTTP_CF_CONNECTING_IP);
The ipaddress is always null.
httpServletRequest.getRemoteAddr()
always gives the cloud flare ip address.
Have found this http://danielmiessler.com/blog/getting-real-ip-addresses-using-cloudflare-nginx-and-varnish for websites using jninix.
Do we have a similar solution for apache http server
Found solution by loading
LoadModule cloudflare_module modules/mod_cloudflare.so
This sets the remote ip instead of cloudflare's ip