Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] jetty-runner --stats not working

After some time trying to figure this out, found a working solution how to overcome the limitation :) 

Replied with my answer below on stackoverflow, link in first email.

In case anyone will face same issue as @KevinG here is my solution, since i found this topic trying to solve same issue, after thinking for some time, i have found the way how to overcome the limitation, that stats can be called only locally from machine/server that jetty-runner is running on.

First setup nginx on same server/machine where you are running jetty-runner. Make sure you use proxy forward in nginx config to forward all traffic to jetty-runner (localhost:8080). Your nginx by default should be listening on port 80. Open http://localhost:80 from your host server/machine/local pc and nginx will forward your request to jetty-runner and will return reply. Same will work with /stats/. Open http://localhost:80/stats/ on your host/local pc and you will reach stats page of jetty-runner.

nginx config:

server {

listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;

## default location ##
location / {
  access_log off;
  proxy_pass http://localhost:8080;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}


On Apr 3, 2016, at 01:34, Vytis V <fogers@xxxxxxxxx> wrote:

Hi guys,

i hope i will find some help here as googling and StackOverflow didn’t help. I found description of the issue also here > https://stackoverflow.com/questions/26791966/jetty-runner-stats-endpoint-only-available-at-localhost-how-to-open-to-network by some guy who had same issue as i do and didnt get reply with solution

IN my case, i have port forwarding using vagrant, so that jetty-runner running on port 8080 is forwarded to host machine on port 1234, so from my local pc i’m accessing guest machine where jetty-runner is running my app by localhost:1234 and it works fine, but if i try to localhost:1234/stats i get error.

Any help would be much appreciated!

running this on guest machine: java -jar jetty-runner-9.3.8.v20160314.jar --stats unsecure hello.war 

on host machine (local pc)

HTTP ERROR: 503

Problem accessing /stats/. Reason:

    Service Unavailable

==============================


Hello Index

Try the servlet.


Powered by Jetty:// 9.3.8.v20160314


Back to the top