Can a webpage, hosted by tomcat, websocket connect over port 80 to an erlang server on the same machine as tomcat? - http

I would like to use tomcat to serve a web page. The webpage will make a connection using websockets over port 80. Does this mean I need a java servlet (hosted by tomcat) to listen for a websocket connection? Or can I use some other application to say written in erlang to listen for the websocket connections.
I'm confused about whether if I use tomcat to serve the webpage, I'm also forced to use it to listen for websockets over port 80. I would have tomcat and the erlang app on the same machine.

The WebSocket server could be listening on some other port than the one used to serve your HTML page (80 presumably) and might even be on a separate domain/server. As long as it respects the specification, you could use any language/framework to write a WebSocket server.

There are issues of Cross Domain scripting which is usually blocked by Web Clients. However, i ask my self, why don't you let your favorite Erlang web server like Yaws or Mochiweb serve that very page from which web socket requests will be initiated?
On the same server, you can have both Tomcat and another Web server running. You can let Tomcat be on Port 80, while the other Erlang web server on say port 8080. Let the page that points to your web sockets page have the link as say: Click here to start web sockets application
You can as well do port forwarding and stuff like that on your Server room firewall (router) to map requests incoming on one port to another

Related

Why do i need to configure an extra port for Websphere Application server

We use an Apache HTTP server with a Websphere Application Server 8.5
Requests to HTTP servers work on default port 80
I have configured port 2021 on http.conf + in default host in Websphere and everything works. The only 'problem' i have is that we need port info in the URL.
http://oursite/index.html works
http://oursite/myApp.jsp doesn't work
When i add the portnumer to the request it works.
I understand that this extra port is needed to tell HTTP server that this request should be forwarded to Websphere. But customers are complaining that the port we used is blocked by their firewall and some customers refuse to add this port to give access.
Now i tried to add port 80 to the Websphere config (default host) and this seems to work.
Is it really needed to config an additional port ?
*:80 is in the "default_host" by default. Whatever host and port your clients will use to address the proxy must be present in the virtual host that your application is deployed to -- otherwise it won't be handled by the WAS Plug-in.
It sounds like someone removed that *:80 alias from the default host, mistakenly thinking it only needed to be there if the application server explicitly listened on port 80. That is misguided.

Intercepting application HTTP/HTTPS traffic with a proxy

As part of my job,
I need to intercept the communication between a native windows application to a web server.
My connection to the environment is through an SSL-VPN.
The application (.exe) is installed on my PC and is communicating in HTTPS with the web server over port 1912.
Usually I use Burp proxy in order to intercept the communication between a browser and a server (configuring the proxy through the browser config). Yet,
In this implementation (native windows application) I cannot figure out how to route the traffic to a proxy.
Is there any specific proxy or configuration which I can use in order to that and use Burp (because it is a web proxy.. I need to mess with HTTP requests)?
First thing you have to understand is whether this native application is programmed to use proxy. If it can use proxy, it could obtain proxy information from the Windows system or you might need to configure just for the application inside the application.
Other possibility it to use the default gateway, and redirect requests with HTTP response 3XX to your proxy. It might work depending on your native application. The default gateway might just act as a proxy.
I suppose here you are not talking about reverse proxy and forward proxy caching (https://docs.trafficserver.apache.org/en/4.2.x/admin/reverse-proxy-http-redirects.en.html)

Sending http request behind nginx

I am not sure how to formulate my question but here we go:
I have 2 servers, one is the nginx reverse proxy and one is the app server.
In my app server, I am developing a simple http client using jerseyclient that will send a request to another server. I can do this now but the traffic goes from the app server and directly to the destination. Is it possible to it from the app server, passes through the reverse proxy server and goes to the destination?
And, is this design ok or is it an abomination?
nginx reverse proxy works only for requests outside your network.
To configure your system works as you described you have to configure firewall NAT or caching HTTP proxy like squid etc.
If you have no reasons why your servers should look as single computer - your configuration is OK.

Iframe request come from client or intermediate server?

So, a Client connects to Server A, which then creates an iframe pointed at Server B. The Client submits a request through the iframe to Server B. Does Server B see the request as coming from the Client or from Server A?
Application: I have two services running on one machine, let's say one on port 443 and one on port 9090. Port 9090 is closed at the firewall, but it can be accessed from other services on the host machine. If I host a page on 443 with an iframe directed at port 9090, will that service see that request as coming from the host machine and send the data, or from the external client and drop the connection?
Server B will see the request coming from the client browser not from server A.
Generally Iframes are requesting its URL from the client browser.

Why when using SSL and Port 443 only am I getting a Socket Refused Error on Port 80?

I have a ASP.NET MVC site set up in IIS7 on Win2K8 with a single SSL binding on Port 443. The team in charge of the server only has port 443 open for security reasons, but this shouldn't be any issue because that's the only binding I have and I'm not making any regular HTTP calls on port 80.
When I call my site, my main login page (using forms authentication) comes up in the browser (over HTTPS) which looks fine. However, as soon as I try to login I get the following error:
[SocketException (0x274d): No connection could be made because the target machine actively refused it 10.x.123.123:80]
Ok that is the correct IP assigned to the site, but I'm not making any calls on port 80. Why would I get this error if all I need is a SSL binding on port 443? Am I required to have port 80 open as well? I'm not making any calls internally that use port 80, unless MVC is doing something I'm unaware of that requires port 80.
When digging into the code it turns out that our service turned around and made additional REST calls to other parts of the same service using a HTTP url, thus causing the error.
Since I configured IIS to only allow SSL traffic and I had internal calls to a HTTP URL the error was generated. The root cause was that I forgot we were making RESTful calls within the code and those URLs had to be updated to their respective HTTPS counterpart.

Resources