Score:0

Nginx proxy_pass incorrectly using SSL

hk flag

I'm using X-Sendfile=X-Accel-Redirect with an internal location so one application (app1) can handle authentication/authorization for another application (app2). Apache handles the SSL and proxies to Nginx via HTTP. Nginx proxies to app1 via HTTP. Nginx is configured to proxy to app2 via HTTP, but the request is always HTTPS and times out because app2 doesn't accept HTTPS. When I connect to Nginx directly via HTTP, Nginx uses HTTP to proxy to app2. This isn't an issue in my testing environment where Apache does not use SSL.

# Apache
<VirtualHost *:80>
  Redirect 301 / https://server
</VirtualHost>

<VirtualHost *:443>
  SSLEngine on 
  # other SSL settings omitted

  ProxyPass /app2 http://localhost:9070/app2 # nginx
  ProxyPassReverse /app2 http://localhost:9070/app2
  ProxyPassReverse / https://localhost:9070/ # sometimes response Location headers have https

  ProxyPass / http://localhost:9105/ # app1 (direct)
  ProxyPassReverse / http://localhost:9105/
</VirtualHost>
# Nginx
http {
  server {
    listen 9070;
    location /app2/ {
      proxy_set_header X-Forwarded-Server $host:$server_port;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Sendfile X-Accel-Redirect;
      proxy_pass http://127.0.0.1:9105/app2/; # app1's route for handling app2's access
    }
    location @app2 {
      internal;
      set $stored_real_path $upstream_http_x_real_location; # X-Real-Location is the path after /app2/
      proxy_pass http://127.0.0.1:9106/$stored_real_path; # app2
    }
  }
}
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.