Answer the question
In order to leave comments, you need to log in
How to proxy java application?
There is a Java web application nailed to Windows (running on local Jetty) and available at localhost:8080/app. The task is to provide access to the application from the outside by a domain name. I decided to use a Linux virtual machine with a real IP and a fixed domain, on which to launch nginx and proxy it to the Win machine using proxy_pass. Actually, I did this more than once, but it doesn’t work with such a bunch - either 500 Internal Error, or Authentication failed even without an authorization request, or a list of files opens in / app. Tried Apache and mod_proxy - same story.
Answer the question
In order to leave comments, you need to log in
In the end, I resolved the issue this way.
1) Using a direct link like my.domain/app, the application started to open, but using the link my.domain - a mess of service messages.
2) I had to use an intermediate index.html with a single link to the login page.
Final config (extra, such as ssl settings, removed)
server {
server_name my.domain;
root /var/www/mydomain;
index index.html index.htm;
location /app/ {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.0.100:8080/app/;
client_max_body_size 1000M;
}
}
Why proxy? You can forward the external 80/443 port to the internal 8080. Forwarding should be done in the router or in the system (if the wire is directly connected). Then set up A-records for your external IP.
Here is my working configuration for proxying Jira to the outside via nginx. Yes, I want to note that I have Jira on the same machine, and I have not tried proxying the application from the same network. But I don't see any problems here.
server {
listen jira.orgname.local:80;
server_name jira.orgname.local;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://jira.orgname.local:8080/;
client_max_body_size 1000M;
}
}
<PC-NAME>:8080/app
, where PC-NAME is the name of your computer? Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question