Login.html

Hello,

I am having an issue with Reverse Proxy to a site that uses login.html
as
it’s index page. I went ahead and used this as my index:

   location / {
            proxy_pass  http://10.10.1.158:9080/;
            index       login.html;

When I navigate to the reverse proxy if I can only reach the login page
with
an absolute url:

http://myproxy.com/login.html

instead of:

http://myproxy.com

Any suggestions on how to fix this?

Scott

I am having an issue with Reverse Proxy to a site that uses login.html as it’s
index page. I went ahead and used this as my index:

   location / {
            proxy_pass  http://10.10.1.158:9080/;
            index       login.html;

I doubt proxy_pass cares about index fallbacks – nginx will serve
whatever
the upstream hands back to it based on the request. So… is the
upstream
correctly configured to use login.html as the default index file? If
you’re
trying to get around some kind of upstream ugliness, you probably need
to do
a redirect to /login.html instead.

  • Jeff


The Great Australian Internet Blackout
http://www.internetblackout.com.au/

    "We must be proactive, eternally vigilant, forever fighting,
         overwhelmingly clever and handsome." - Robert Love

On Tue, Jun 01, 2010 at 11:17:32AM -0500, Scott Behrens wrote:

an absolute url:

http://myproxy.com/login.html

instead of:

http://myproxy.com

Any suggestions on how to fix this?

Two ways:

  1. configure backend to handle “/” as “/login.html”

  2. or proxy only “/” to “/login.html”:

     location = / {
              proxy_pass  http://10.10.1.158:9080/login.html;
     }
    
     location / {
              proxy_pass  http://10.10.1.158:9080;
     }
    


Igor S.
http://sysoev.ru/en/

Jeff,

Could you elaborate a bit more on the rewrite (I’m looking at some
examples now…still not certain)

http://wiki.nginx.org/NginxConfiguration#Rewrite_examples

Thank-you,

Scott

Posted at Nginx Forum:

location = / {
proxy_pass http://10.10.1.158:9080/login.html;
}

I tried this but the page wouldn’t load anything but html characters.
Javascript did not load nor did any image files. When I attempted to
login after the POST finished I got page not found.

location / {
proxy_pass http://10.10.1.158:9080;

When I navigated to the root proxy page, nothing happened. If I
specified login.html, everything loaded as expected and I could log in.

Any other suggestions?

Posted at Nginx Forum:

On Wed, Jun 02, 2010 at 09:31:50AM -0400, sbehrens wrote:

When I navigated to the root proxy page, nothing happened. If I specified login.html, everything loaded as expected and I could log in.

Any other suggestions?

Could you create a debug log ?
http://nginx.org/en/docs/debugging_log.html


Igor S.
http://sysoev.ru/en/

On Wed, Jun 02, 2010 at 09:49:46AM -0400, sbehrens wrote:

Jeff,

Could you elaborate a bit more on the rewrite (I’m looking at some examples now…still not certain)

http://wiki.nginx.org/NginxConfiguration#Rewrite_examples

Short version: never use rewrite.


Igor S.
http://sysoev.ru/en/

Here are a few debug logs. Also I am testing this all on a local domain
until I get everything working. I know that doesn’t matter but just
in-case you saw that in the config file. With this setup, if i navigate
to my site with /login.html it loads, but if i navigate to the parent
page it does not load.

error.log
2010/05/25 08:48:23 [emerg] 1533#0: bind() to 0.0.0.0:443 failed (98: 
Address already in use)
2010/05/25 08:48:23 [emerg] 1533#0: bind() to 0.0.0.0:443 failed (98: 
Address already in use)
2010/05/25 08:48:23 [emerg] 1533#0: bind() to 0.0.0.0:443 failed (98: 
Address already in use)
2010/05/25 08:48:23 [emerg] 1533#0: bind() to 0.0.0.0:443 failed (98: 
Address already in use)
2010/05/25 08:48:23 [emerg] 1533#0: bind() to 0.0.0.0:443 failed (98: 
Address already in use)
2010/05/25 08:48:23 [emerg] 1533#0: still could not bind()
2010/05/25 13:11:12 [emerg] 2383#0: 
SSL_CTX_use_certificate_chain_file("/usr/local/nginx/conf/ssl/proxy.matlockcaptial.com.crt") 
failed (SSL: error:02001002:system library:fopen:No such file or 
directory error:20074002:BIO routines:FILE_CTRL:system lib 
error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system 
lib)
2010/05/25 13:12:21 [emerg] 2395#0: 
SSL_CTX_use_certificate_chain_file("/usr/local/nginx/conf/ssl/proxy.matlockcaptial.com.crt") 
failed (SSL: error:02001002:system library:fopen:No such file or 
directory error:20074002:BIO routines:FILE_CTRL:system lib 
error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system 
lib)
2010/05/28 09:32:39 [emerg] 16800#0: 
SSL_CTX_use_PrivateKey_file("/usr/local/nginx/conf/ssl/proxy.sanitizedsite.com.key") 
failed (SSL: error:06065064:digital envelope 
routines:EVP_DecryptFinal_ex:bad decrypt error:0906A065:PEM 
routines:PEM_do_header:bad decrypt error:140B0009:SSL 
routines:SSL_CTX_use_PrivateKey_file:PEM lib)
2010/05/28 09:32:48 [emerg] 16801#0: 
SSL_CTX_use_PrivateKey_file("/usr/local/nginx/conf/ssl/proxy.sanitizedsite.com.key") 
failed (SSL: error:06065064:digital envelope 
routines:EVP_DecryptFinal_ex:bad decrypt error:0906A065:PEM 
routines:PEM_do_header:bad decrypt error:140B0009:SSL 
routines:SSL_CTX_use_PrivateKey_file:PEM lib)
2010/05/28 09:57:16 [emerg] 16916#0: unknown directive 
"ssl_perfer_server_ciphers" in /usr/local/nginx/conf/nginx.conf:47
2010/05/29 04:00:43 [emerg] 1426#0: 
SSL_CTX_use_PrivateKey_file("/usr/local/nginx/conf/ssl/proxy.sanitizedsite.com.key") 
failed (SSL: error:0906406D:PEM routines:PEM_def_callback:problems 
getting password error:0906A068:PEM routines:PEM_do_header:bad password 
read error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib)
2010/06/01 11:28:27 [emerg] 17365#0: "proxy_cache" zone "cache" is 
unknown in /usr/local/nginx/conf/nginx.conf:76
2010/06/02 09:01:49 [emerg] 22132#0: 
SSL_CTX_use_PrivateKey_file("/usr/local/nginx/conf/ssl/proxy.sanitizedsite.com.key") 
failed (SSL: error:06065064:digital envelope 
routines:EVP_DecryptFinal_ex:bad decrypt error:0906A065:PEM 
routines:PEM_do_header:bad decrypt error:140B0009:SSL 
routines:SSL_CTX_use_PrivateKey_file:PEM lib)
ssl-error.log

2010/06/02 07:48:53 [error] 21819#0: *3 open() 
"/usr/local/nginx/html/res/-4045289697674020822.js;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/-4045289697674020822.js;jsessionid=6655B4E200A841134A80B4C3FEE908CC?v=1273871614523 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:48:53 [error] 21819#0: *6 open() 
"/usr/local/nginx/html/res/5519527726661553067.css;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/5519527726661553067.css;jsessionid=6655B4E200A841134A80B4C3FEE908CC?v=1273871614523 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:48:53 [error] 21819#0: *5 open() 
"/usr/local/nginx/html/res/-7047022519376031888.css;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/-7047022519376031888.css;jsessionid=6655B4E200A841134A80B4C3FEE908CC?v=1273871614523 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:48:53 [error] 21819#0: *3 open() 
"/usr/local/nginx/html/img/logoLogin.gif;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/img/logoLogin.gif;jsessionid=6655B4E200A841134A80B4C3FEE908CC 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:48:53 [error] 21819#0: *6 open() 
"/usr/local/nginx/html/img/ajax-loader.gif;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/img/ajax-loader.gif;jsessionid=6655B4E200A841134A80B4C3FEE908CC 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:48:53 [error] 21819#0: *5 open() 
"/usr/local/nginx/html/img/help.gif;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/img/help.gif;jsessionid=6655B4E200A841134A80B4C3FEE908CC HTTP/1.1", 
host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:48:53 [error] 21819#0: *3 open() 
"/usr/local/nginx/html/favicon20.ico;jsessionid=6655B4E200A841134A80B4C3FEE908CC" 
failed (2: No such file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/favicon20.ico;jsessionid=6655B4E200A841134A80B4C3FEE908CC HTTP/1.1", 
host: "10.10.1.98"
2010/06/02 07:49:02 [error] 21819#0: *6 open() 
"/usr/local/nginx/html/login.html" failed (2: No such file or 
directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET /login.html HTTP/1.1", 
host: "10.10.1.98"
2010/06/02 07:49:05 [error] 21819#0: *3 open() 
"/usr/local/nginx/html/res/-8762791360234593415.js" failed (2: No such 
file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/-8762791360234593415.js?v=1273871614523 HTTP/1.1", host: 
"10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *6 open() 
"/usr/local/nginx/html/res/-7047022519376031888.css" failed (2: No such 
file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/-7047022519376031888.css?v=1273871614523 HTTP/1.1", host: 
"10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *5 open() 
"/usr/local/nginx/html/res/5519527726661553067.css" failed (2: No such 
file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/5519527726661553067.css?v=1273871614523 HTTP/1.1", host: 
"10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *8 open() 
"/usr/local/nginx/html/res/-4045289697674020822.js" failed (2: No such 
file or directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET 
/res/-4045289697674020822.js?v=1273871614523 HTTP/1.1", host: 
"10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *3 open() 
"/usr/local/nginx/html/img/logoLogin.gif" failed (2: No such file or 
directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET /img/logoLogin.gif 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *6 open() 
"/usr/local/nginx/html/img/ajax-loader.gif" failed (2: No such file or 
directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET /img/ajax-loader.gif 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *5 open() 
"/usr/local/nginx/html/img/help.gif" failed (2: No such file or 
directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET /img/help.gif HTTP/1.1", 
host: "10.10.1.98", referrer: "https://10.10.1.98/"
2010/06/02 07:49:05 [error] 21819#0: *8 open() 
"/usr/local/nginx/html/favicon20.ico" failed (2: No such file or 
directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "GET /favicon20.ico HTTP/1.1", 
host: "10.10.1.98"
2010/06/02 07:49:13 [error] 21819#0: *3 open() 
"/usr/local/nginx/html/loginSubmit.html" failed (2: No such file or 
directory), client: 10.10.1.194, server: 
mwebproxy01.sanitizedsite.local, request: "POST /loginSubmit.html 
HTTP/1.1", host: "10.10.1.98", referrer: "https://10.10.1.98/"
nginx.conf

pid               logs/nginx.pid;
user              nginx nginx;
worker_processes  10;

events {
    worker_connections  1024;
}

http {
  default_type       application/octet-stream;

 ## Common options ##
 include options.conf;

 ## Proxy settings ##
 include proxy.conf;
 include mime.types;

        server {
        ### server port and name ###
        listen          443 ssl;
        server_name     mwebproxy01.sanitizedsite.local;

        ### SSL log files ###
        access_log      logs/ssl-access.log;
        error_log       logs/ssl-error.log;
        index           login.html;
        root        /usr/local/nginx/html;

        ssl on;
        ### SSL cert files ###
        ssl_certificate      ssl/proxy.sanitizedsite.com.crt;
        ssl_certificate_key  ssl/proxy.sanitizedsite.com.key;
        ### Add SSL specific settings here ###
        keepalive_timeout    60;

        ###  Limiting Ciphers ########################
        ssl_ciphers HIGH:!ADH;
        ssl_protocols SSLv3;


        location  / {
                proxy_pass  http://10.10.1.158:9080/;
                ### force timeouts if one of backend is died ##
                proxy_next_upstream error timeout invalid_header 
http_500 http_502 http_503;
                proxy_cache            cache;
                proxy_cache_valid      200 24h;
                proxy_cache_use_stale  error timeout invalid_header 
updating http_500 http_502 http_503 http_504;
                proxy_ignore_headers   Expires Cache-Control;

                ### Set headers ####
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;

                ### Most PHP, Python, Rails, Java App can use this 
header ###
                proxy_set_header X-Forwarded-Proto https;

                ### By default we don't want to redirect it ####
                proxy_redirect     off;
        }
   }
}

Posted at Nginx Forum:

On Wed, Jun 02, 2010 at 10:58:23AM -0400, sbehrens wrote:

Here are a few debug logs. Also I am testing this all on a local domain until I get everything working. I know that doesn’t matter but just in-case you saw that in the config file. With this setup, if i navigate to my site with /login.html it loads, but if i navigate to the parent page it does not load.

This is not debug log, since you probably either did not build nginx
–with-debug or do not set debug level for error_log.
Anyway, it seems that problem is that you still run nginx with old
configuration, because nginx does not accept new configuration due to
many emergency errors. You should either look in error_log after
each reconfiguration or test configuration: “nginx -t” before
reconfigure to see errors.

2010/05/28 09:32:39 [emerg] 16800#0: SSL_CTX_use_PrivateKey_file(“/usr/local/nginx/conf/ssl/proxy.sanitizedsite.com.key”) failed (SSL: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt error:0906A065:PEM routines:PEM_do_header:bad decrypt error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib)
2010/06/02 07:48:53 [error] 21819#0: *3 open() “/usr/local/nginx/html/res/-4045289697674020822.js;jsessionid=6655B4E200A841134A80B4C3FEE908CC” failed (2: No such file or directory), client: 10.10.1.194, server: mwebproxy01.sanitizedsite.local, request: “GET /res/-4045289697674020822.js;jsessionid=6655B4E200A841134A80B4C3FEE908CC?v=1273871614523 HTTP/1.1”, host: “10.10.1.98”, referrer: “https://10.10.1.98/
2010/06/02 07:49:05 [error] 21819#0: *8 open() “/usr/local/nginx/html/res/-4045289697674020822.js” failed (2: No such file or directory), client: 10.10.1.194, server: mwebproxy01.sanitizedsite.local, request: “GET /res/-4045289697674020822.js?v=1273871614523 HTTP/1.1”, host: “10.10.1.98”, referrer: “https://10.10.1.98/
pid logs/nginx.pid;

Common options

    ### Add SSL specific settings here ###
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
            ### Most PHP, Python, Rails, Java App can use this header ###

Posted at Nginx Forum: Re: login.html


nginx mailing list
[email protected]
nginx Info Page


Igor S.
http://sysoev.ru/en/

Igor,

I got this when running nginx -t:

[root@mwebproxy01 nginx]# sbin/nginx -t
Enter PEM pass phrase:
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@mwebproxy01 nginx]#

I will go ahead and take a look at rebuilding this with debug.

Scott

Posted at Nginx Forum: