Коллеги нужна помощь.
Понадобилось тут изобразить captive portal.

Завёл на стенде тестовую сеть, на шлюзе сделал
-A PREROUTING ! -d 192.168.11.3/32 -i ens4 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.11.3

Далее в nginx  заведено 2 виртуальных хоста:
===
server {
#    # Listening on IP Address.
#    # This is the website iptables redirects to
    listen       80 default_server;
    root         /var/www/html/portal;
    access_log  /var/log/nginx/access1.log atop;
    port_in_redirect off;
    keepalive_timeout 0;

    location / {
        return 302 http://test.ppcom:82;
    }
 }

server {
     listen       82;
     server_name  test.ppcom;
     root         /var/www/html/portal;
     access_log  /var/log/nginx/access2.log atop;

add_header Cache-Control no-cache;
# set the Expires header to 31 December 2037 23:59:59 GMT, and the Cache-Control max-age to 10 years
expires 0;

     location / {
         try_files $uri $uri/ /index.html;
     }
}

===
Локальный DNS резолвит test.ppcom так же в 192.168.11.3.

Но не выходит каменный цветок. Но если портал повесить на 80 порт сразу,куда заворачивает трафик iptables то на андроидах всё таки рисуется страница от портала. Вопрос - что упускаю их вида,что не отрабатывает вариант с редиректом из nginx на страницу портала?


Причём в дампе я вижу, что nginx отдаёт

Hypertext Transfer Protocol
HTTP/1.1 302 Moved Temporarily\r\n
Server: nginx/1.14.0\r\n
Date: Sun, 14 Oct 2018 17:07:54 GMT\r\n
Content-Type: text/html\r\n
Content-Length: 161\r\n
Connection: close\r\n
Location: http://test.ppcom:82\r\n
\r\n



правда при этом вижу в дампе ещё ниже

Line-based text data: text/html (7 lines)
<head><title>302 Found</title></head>\r\n
<body bgcolor="white">\r\n
<center><h1>302 Found</h1></center>\r\n
<hr><center>nginx/1.14.0</center>\r\n
</body>\r\n
</html>\r\n

_______________________________________________
nginx-ru mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Ответить