Welcome! Log In Create A New Profile

Advanced

captive portal

Антон Горлов
October 14, 2018 01:48PM
Коллеги нужна помощь.
Понадобилось тут изобразить 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
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

captive portal

Антон Горлов October 14, 2018 01:48PM

Re: captive portal

Антон Горлов October 17, 2018 04:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
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