reverse proxying towards various hardware devices

Paul Swielingen lists at ruby-forum.com
Sun Jan 24 15:54:10 MSK 2010


Maxim Dounin wrote:
> Hello!
> 
> On Sat, Jan 23, 2010 at 04:45:07PM +0100, Paul Swielingen wrote:
> 
>> 
>>     location / {
>>     }
>> 
>> I am aware that I could destine all these devices to their own port but
>> I don't want to do that because securing them will become very
>> difficult. Therefore I don't want to take that path.
>> 
>> I know of the existence of referrers but I do not understand how to
>> approach using that. Anybody can help me?
> 
> It's up to the device in question to form correct links on pages
> it returns.  If it doesn't do so - some limited changes may be
> done by sub filter module.  But it's not really a solution as it's
> not able to parse and interpret all of the returned code (even if
> teach it to parse html - what to do with broken html, javascript,
> css, xml+xslt and so on?).
> 
> So the only generic solution is to use separate hosts (or ports).
> You may still proxy them via nginx, i.e. write something like
> this:
> 
>     server {
>         server_name device.example.com;
> 
>         location / {
>             proxy_pass http://real-device.example.com;
>             proxy_set_header Host $host;
>         }
>     }
> 
> and make sure device thinks it's called "device.example.com" while
> this name in fact points to nginx server.
> 
> Maxim Dounin

Thanks for the reply Maxim,

Most devices return a mix of correct (i.e. relative) and incorrect (i.e. 
links that start with a /) links. They were never designed to return 
relative links only.

I already had suspicions in the direction 'the only generic solution is 
to use separate hosts (or ports)'.

I had hoped it would be possible for NGINX to add something to the page 
from the 'real-device' before forwarding it to the client browser and 
than on the browsers next request catching it when receiving a new 
request from the browser and use that information to forward it to the 
proper device again in.

Regarding your proposal: It forwards / to the real-device.
Does that imply any request is forwarded to real-device?
If so how to forward to my other devices?
-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list