I want to query a remote service that should serve a dynamic html.
For this reason I don't want to serve a static local (relative to my raspberry) html
No there is no need for authentication. I've created an unprotected wifi network. Then I could close all connection that not pass through http or https. I want that customers enter in a shop, they connect to the open network, open the browser and whatever they write in the query string they receive the same page returned from my remote service.
Then captive portal it is. You'll have to customize it to get the page from the remote server and what action will the users need to do to be able to use the internet.
ok thank you, but I have difficulty in finding a tutorial that reflects my configuration. normally OpenWrt is installed directly on a router, but me I'm behind the ISP router with my Raspberry and I can't understand how to proceed. Do you casually know about tutorial covering my needs or something similar?
Your clients connect to the wireless interface on a RPi, which is also connected to the LAN interface from the ISP's router, in a different network. Your RPi is routing between two networks. Your RPi is a router.
but with this configuration what happens if the user requests for another page? the captive portal should block them?
If I've understood how it works, to be able to access a remote page I have to enable user internet connectivity. So if the user inserts a different address in the browser don't is he able to navigate everywhere?
Hi guys, I'm back again.
I tried the captive portal solution but I can confirm that is not what I need.
I've found a solution adding some custom traffic rules:
In this way, I can redirect all requests coming from IP in the range [192.168.2.2,192.168.2.255] excluding in this way the router.
I'm redirecting directly to a static IP (in this case I'm trying against ovh IP) and it partially works: I receive a 502.
I think the problem is that it can't query a DNS server using my wireless network, could it be the problem?
However now my real problem is that I want to query a service that does not have a static IP address, so I would use a DNS server in order to query the right address (e.g. www.myservice.com/api/myendpoint )
You're trying to re-invent the captive portal. Understand how captive portal software works and the system you want is already done for you.
A captive portal includes a captive DNS server. A not logged in user will receive the IP of your "bounce" page no matter what name he requests. This is mostly so the browser doesn't hang waiting for DNS. It is not the only mechanism to ensure the user only has access to your page. If he requested directly by IP any IP he requests will be redirected to the bounce page as well.
The captive portal also handles internally DNSing your page if you configure it by name instead of by number.
All these rules were completely unnecessary. The RPi will not use the 192.168.2.1 IP as source for anything else other than directly communicating with the wifi clients.
You are rerouting everything to 198.27... so unless this can answer DNS queries, then you have a problem.
As @mk24 pointed out you are trying to reinvent the CP.