# Rev. proxying a java applet

**URL:** <https://www.ruby-forum.com/t/rev-proxying-a-java-applet/244278>\
**Category:** NGINX\
**Created:** [March 14, 2016, 5:39pm UTC](https://www.ruby-forum.com/t/rev-proxying-a-java-applet/244278 "2016-03-14T17:39:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [March 14, 2016, 5:39pm UTC](https://www.ruby-forum.com/t/rev-proxying-a-java-applet/244278/1 "2016-03-14T17:39:37Z")

</div>

Hi,

I’m a beginner to nginx.

I want to rev. proxying a page with java applet. I think it is usual and  
nothing special …

This is my 1st config:

```
location /pl-wbr/ {
    rewrite /pl-wbr/(.*) /$1 break;
    proxy_pass http://pl-wbr/;
    #proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

```

The java applet wants to connect to TCP/7000 on the proxied host.  
Something has happened but it doesn’t work. ☹

I checked the access.log on the proxied Apache host and I couldn’t see  
big  
differences.  
I think it is too general: I don’t know any special thing about applet.  
It  
is a simple serial  
terminal on WEB page.  
I used tcpdump to watch the network traffic and no communication on port  
7000 on  
my client machine.

Any help would be appreciated!

TIA,

Posted at Nginx Forum:

> **[Rev. proxying a java applet](https://forum.nginx.org/read.php?2,265320,265320#msg-265320)**
>
> Hi, I'm a beginner to nginx. I want to rev. proxying a page with java applet. I think it is usual and nothing special ... This is my 1st config: location /pl-wbr/ { rewrite /pl-wbr/(.\*) /$1 break; proxy\_pas

---

<div class="post-metadata">

**Author:** ![aruzsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6bbea6/32.png) [@aruzsi](https://www.ruby-forum.com/u/aruzsi)\
**Post date:** [March 16, 2016, 9:43am UTC](https://www.ruby-forum.com/t/rev-proxying-a-java-applet/244278/2 "2016-03-16T09:43:30Z")

</div>

On Mon, Mar 14, 2016 at 12:39:11PM -0400, aruzsi wrote:

Hi there,

> I want to rev. proxying a page with java applet. I think it is usual and  
> nothing special …

The applet itself will be a http request, which it looks like you have  
working.

What the applet actually _does_ is another matter – and in general,  
only you know what that is.

> The java applet wants to connect to TCP/7000 on the proxied host.  
> Something has happened but it doesn’t work. ☹

Can you describe the full network traffic when the applet works  
normally?

The machines involved are:

- the client (your browser)
- the nginx server
- the upstream web server

If nginx were not involved, the client would make a http request of the  
upstream web server to fetch the applet, and then… what?

The applet runs on the client and tries to access port 7000 of the  
server  
the client got it from? And speaks http on port 7000; or speaks its own  
protocol? Does it use anything other than port 7000?

If it speaks http, then possibly a nginx http server{} which listens on  
port 7000 and proxy\_passes to the upstream port 7000 could work.

If it uses a single port, then possible a nginx stream server{}  
could work.

If the applet knows the upstream it came from, and tries to access that  
directly, then nginx is probably not involved.

The best way to understand how to proxy this service (if it is even  
possible), is to know what it wants to do, at the network level.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![aruzsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6bbea6/32.png) [@aruzsi](https://www.ruby-forum.com/u/aruzsi)\
**Post date:** [March 16, 2016, 11:44am UTC](https://www.ruby-forum.com/t/rev-proxying-a-java-applet/244278/3 "2016-03-16T11:44:25Z")

</div>

Hi Francis,

Thank you for your questions. 😉  
I try to answer them as I can.

> > I want to rev. proxying a page with java applet. I think it is usual  
> > and  
> > nothing special …
> 
> The applet itself will be a http request, which it looks like you have  
> working.

The start page is almost working.  
First of all there are some upstream servers which are connected to  
different devices (serial line) so I want some URL to different the  
servers or (places).

So I use [http://nginx.server.com/](http://nginx.server.com/)/\<orig\_URL\>.

Something is working because IcedTea asks my permissions for  
Java thing and the siloutte of the WEB page appears full of error  
messages (missing IDs, etc.)  
I think this first stage is not correct because the different (virtual)  
URL.

> What the applet actually _does_ is another matter – and in general,  
> only you know what that is.

Yes, I know this. I just think I know some thing about the behaviour  
of the applet on the network.

> > The java applet wants to connect to TCP/7000 on the proxied host.  
> > Something has happened but it doesn’t work. ☹
> 
> Can you describe the full network traffic when the applet works  
> normally?

Maybe. I can use tcpdump of course.  
With rev. proxy and without it (through SSH port forwarding). Is that  
right for you?

> The machines involved are:
> 
> - the client (your browser)
> - the nginx server
> - the upstream web server

OK.  
As I can see no communication between my client (browser) and  
upstream server. It would not be a problem, because I want to  
proxying everything (separated subnet, no route, firewall, etc.),  
But my browser needs communicate on TCP/7000 port to the  
nginx or upstream server and it doesn’t try. ☹  
I think some other Java archives (.jar) not loaded by my browser.  
I don’t know why.

> If nginx were not involved, the client would make a http request of  
> the  
> upstream web server to fetch the applet, and then… what?

I don’t know.  
I tried to check the upstream server’s Apache access and error.log  
without any information for me except missing some Java files  
when nginx is involved in the request.

> The applet runs on the client and tries to access port 7000 of the  
> server  
> the client got it from? And speaks http on port 7000; or speaks its  
> own  
> protocol? Does it use anything other than port 7000?

I think client try to connect TCP/7000 but not HTTP. (without nginx,  
so in normal situation when no proxy)  
But something is different because I did a test when the TCP/7000  
wasn’t included in SSH port forwarding. The applet started perfectly  
without the error messeges in it (missing IDs, etc.) but when I try to  
connect to the serial port I got an error message that no communication  
which was right because the TCP/7000 wasn’t forwarded.  
So I’m somewhere before the 7000 port problem, I think. The behaviour of  
the  
applet  
is different when the proxy is involved in the communication or normal  
SSH port forwarding was used without (or disabled) TCP/7000 port.  
And that’s why I don’t understand what is the difference!

> If it speaks http, then possibly a nginx http server{} which listens  
> on  
> port 7000 and proxy\_passes to the upstream port 7000 could work.
> 
> If it uses a single port, then possible a nginx stream server{}  
> could work.

Not HTTP protocol, I think. TCP stream between the browser (client) and  
remote server.

> If the applet knows the upstream it came from, and tries to access  
> that  
> directly, then nginx is probably not involved.

I have to proxy all the communication. Of course SSH port forwarding  
will work but I don’t like it or I don’t want it.

> The best way to understand how to proxy this service (if it is even  
> possible), is to know what it wants to do, at the network level.

I try to get some information about this applet.

> Good luck with it,

Thank you. Will you help me if I got more information?

TIA,

Posted at Nginx Forum:  
[https://forum.nginx.org/read.php?2,265320,265387#msg-265387](https://forum.nginx.org/read.php?2,265320,265387#msg-265387)

---

<div class="post-metadata">

**Author:** ![aruzsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6bbea6/32.png) [@aruzsi](https://www.ruby-forum.com/u/aruzsi)\
**Post date:** [March 16, 2016, 11:09pm UTC](https://www.ruby-forum.com/t/rev-proxying-a-java-applet/244278/4 "2016-03-16T23:09:40Z")

</div>

On Wed, Mar 16, 2016 at 06:43:53AM -0400, aruzsi wrote:

Hi there,

> > The applet itself will be a http request, which it looks like you have  
> > working.
> 
> The start page is almost working.  
> First of all there are some upstream servers which are connected to  
> different devices (serial line) so I want some URL to different the  
> servers or (places).
> 
> So I use [http://nginx.server.com/](http://nginx.server.com/)/\<orig\_URL\>.

Start simple.

Get just one working first.

> Something is working because IcedTea asks my permissions for  
> Java thing and the siloutte of the WEB page appears full of error  
> messages (missing IDs, etc.)  
> I think this first stage is not correct because the different (virtual)  
> URL.

Check the apache logs for when you connect to apache directly; you will  
want to know what the full set of requests and responses is.

Then when you go through nginx, do you see the same requests and  
responses? If not, find out why and fix it.

> > What the applet actually _does_ is another matter – and in general,  
> > only you know what that is.
> 
> Yes, I know this. I just think I know some thing about the behaviour  
> of the applet on the network.

You will need to know that, if you want to configure nginx to support  
it.

For example: how does the applet know to use port 7000? How does the  
applet know which server to connect to on port 7000?

> > Can you describe the full network traffic when the applet works  
> > normally?
> 
> Maybe. I can use tcpdump of course.  
> With rev. proxy and without it (through SSH port forwarding). Is that  
> right for you?

SSH port forwarding is a new thing.

Keep it simple.

Until you know what is supposed to happen, you will not be able to know  
whether everything is working the way you want.

> > The machines involved are:
> > 
> > - the client (your browser)
> > - the nginx server
> > - the upstream web server
> 
> OK.  
> As I can see no communication between my client (browser) and  
> upstream server.

Should there be any communication there?

> It would not be a problem, because I want to  
> proxying everything (separated subnet, no route, firewall, etc.),  
> But my browser needs communicate on TCP/7000 port to the  
> nginx or upstream server and it doesn’t try. ☹

Which server should your browser choose? Why should it choose that  
server?

Learn that first, and then it might be clear what you need to configure.

> I think some other Java archives (.jar) not loaded by my browser.  
> I don’t know why.

Which other jars? How does your browser know to load them? Which urls  
does your browser use for them?

Check logs for when things work.

> > server  
> > which was right because the TCP/7000 wasn’t forwarded.  
> > I do not understand what network traffic you are describing.

That’s ok - I don’t need to understand it.

But you should understand it, and be able to draw a picture of what  
talks to what.

> > If it uses a single port, then possible a nginx stream server{}  
> > could work.
> 
> Not HTTP protocol, I think. TCP stream between the browser (client) and  
> remote server.

In that case, nginx is not involved, no?

How does the browser know to talk to the remote server?

> Thank you. Will you help me if I got more information?

If you have enough information, it may be clear what is needed.

So long as it remains nginx-relevant, keep updating this thread.

Someone will probably be able to offer advice.

Cheers,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
