I'm trying to use a raspberry pi (that factor shouldn't make it any different than any other linux box, but may make the application make a bit more sense) to remotely view a website. For example, if I have a printer I want to interact with, that hosts a browser user interface and outputs it via usb, I want to be able to connect to that wirelessly from my phone, in my phone's browser. Currently I am connecting to the printer using a Pi-3, and using tightvnc to view the Pi GUI remotely using the Pi's onboard wifi (to be clear, the Pi isn't connecting to the internet, my phone is just connecting to the Pi's local network, using hostapd). Once I have VNC'd into the Pi, I open the Pi's web browser, then type in the address of the printer (something like http://192.xxx.x.xxx) to access the browser interface. From there, I can do everything I need to (send files to the printer, receiver feedback from the printer when it has printed, etc). It's a little clunkier than I'd like, and would prefer to just be able to open up a browser in my phone and directly interface with my printer. Is there a way to do that? I'll be both sending commands to the printer as well as getting feedback from it.


A couple of things.

First of, some printer makers have Apps that you can control your printer from. Maybe that would help you.

But you have sort of a dilemma here. If you are running your printer from a browser on the Pi, when you do http transactions, the client is the Pi. So if the web page says "Browse to a file to print", you are really browsing the Pi's file system. If that page were open in the Phone's browser, it would be looking inside the Phone's file system for the file.

This is probably not what you want.

Basically you probably want the Pi to be interacting with the printer more than the phone.

Maybe there is someway to let your phone mount the Pi's files as a Network FIle Server drives or something from the Pi, and then printing from the Phone's file system becomes viable. I don't know.

Myself, I'd probably put ssh on the phone and print stuff command via command line while connected to the pi. I'm pretty sure the Pi supports CUPS for printing. But not many people seem to want to do that sort of thing anymore.

| improve this answer | |

You can NAT the web port of your PI's IP to the IP of the printer.

On your PI run the following:

iptables -t nat -A PREROUTING -d X.X.X.X -p tcp --dport 80 -j DNAT --to-destination Y.Y.Y.Y

where X.X.X.X is the IP address of your PI and Y.Y.Y.Y is the IP address of the printer.

Once this is done you should be able to open the printer web interface in your phone's browser by typing the PI's ip address.

This command is not permanent and you would need to run it after every reboot. Making it permanent depends on what distro you're running on PI, most of the times adding above iptables line to /etc/rc.local should make it permanent.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.