Welcome! Log In Create A New Profile

Advanced

Trying to understand what is happening

Posted by saweron 
Trying to understand what is happening
February 29, 2012 11:17AM
Hi,

Using nginx 1.1.10 on Solaris 10 as reverse proxies for basically… well everything :)

We ran into an issue while reverse proxying one certain web application on a single backend server running apache2. We did find a workaround but we're trying to understand what is happening.

When connecting to this server, you download a Flash app which provides a log in screen; the technology behind this is AMF. This worked when we used apache2 as reverse proxy but does not work with nginx.


The conf snippet in question is:

---
server {

listen 10443;
server_name webapp.domain.com;

ssl on;
ssl_certificate /opt/certs/domain.com.crt;
ssl_certificate_key /opt/certs/domain.com.key;


location / {
proxy_pass http://192.168.0.217/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
# catch redirect of back-end
proxy_redirect https://webapp.domain.com/ https://$host:10443/;
}
}
---

What we see in the logs is

---
110.50.0.102 GET / HTTP/1.1 [29/Feb/2012:16:41:59 +0100] status 302 host proxy cache - cookie -
10.50.0.102 GET /Web-App/ HTTP/1.1 [29/Feb/2012:16:41:59 +0100] status 200 host proxy cache - cookie -
[…]
10.50.0.102 POST /Web-Ap/messagebroker/streamingamf HTTP/1.1 [29/Feb/2012:16:42:01 +0100] status 200 host proxy cache - cookie -
---

If we then try to log in, the flash app times out with an error indicating "HTTP: Failed: url: 'https://proxy:10443/Web-App/messagebroker/amfsecure'"; nothing in

Now if we add the following snippet -which I found here on the forums (http://forum.nginx.org/read.php?15,14017)- to the server section:

---
if ($http_cookie ~* "jsessionid=([^;]+)(?:;|$)") {
set $co "jsessionid=$1";
}
proxy_set_header Cookie "$co";
---

everything just works and we notice AMF connecting + a cookie appearing in the log file

---
10.50.0.102 GET / HTTP/1.1 [29/Feb/2012:16:49:15 +0100] status 302 host proxy cache - cookie -
[..]
10.50.0.102 POST /Web-App/messagebroker/streamingamf HTTP/1.1 [29/Feb/2012:16:49:16 +0100] status 200 host proxy cache - cookie -
10.50.0.102 POST /Web-App/messagebroker/streamingamf?command=open&version=1 HTTP/1.1 [29/Feb/2012:16:49:16 +0100] status 400 host proxy cache - cookie JSESSIONID=B1B2C2E940F43DE72BE82C85000401D2
10.50.0.102 POST /Web-App/messagebroker/amflongpolling HTTP/1.1 [29/Feb/2012:16:49:16 +0100] status 200 host proxy cache - cookie JSESSIONID=D8F64D77850C192B41253ED6AF3F5AF0
10.50.0.102 POST /Web-App/messagebroker/amfsecure HTTP/1.1 [29/Feb/2012:16:49:16 +0100] status 200 host proxy cache - cookie JSESSIONID=D8F64D77850C192B41253ED6AF3F5AF0
--

As we understand this we pass along the HTTP cookie 'jsessionid' which is somehow ignored in the initial config.
We did not explicitly set any proxy_cache directives in nginx.

Is this due caching? Is this due to nginx talking HTTP 1.0 to the backend while AMF explicitly requires HTTP 1.1?

Any insight on this would be very much appreciated.

Gregory
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 133
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready