itsjunetime / smserver

An app to allow Jailbroken iPhones to send texts & attachments from their browser
GNU General Public License v3.0
158 stars 27 forks source link

Smserver behind a reverse proxy #68

Closed Andi-bz closed 3 years ago

Andi-bz commented 3 years ago

Hi

I have trouble to run smserver behind a reverse proxy. The initial page loads but if i input the password nothing happen.

nginx config: location /smserver/ { proxy_pass https://192.168.0.50:8741/; }

In the logs of nginx I have found the following: 31.177.115.249 - - [02/Jan/2021:13:42:59 +0000] "GET /requests?password=password HTTP/1.1" 404 199 "https://dyndnsurl/smserver/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.107 Safari/537.36"

So it seems that the request is going to the wrong url. Is possible to implement a webroot?

Thanks

itsjunetime commented 3 years ago

It should be possible, but I'd just like to make sure I'm understanding correctly first:

When you have SMServer running behind your reverse proxy, if you make a request to /smserver/requests?password=password, it will go through and authenticate correctly with SMServer. However, if you make a request to /requests?password=password, it won't go through, since your reverse proxy won't route it to SMServer. So you'd need an option to route all requests on the web interface through the directory of your choice (e.g. route them all through /smserver/ instead of simply /)?

If that's the case, it's definitely possible and should be pretty easy. I'm currently in the middle of a major refactor, so it may be a bit until I can get it implemented, but it'll be on the list for when I get a moment. However, if that's not what you mean or it seems that I'm misunderstanding something, let me know.

Andi-bz commented 3 years ago

If I set up the reverse proxy like the example before the initial request loads the page. After I enter the password and hit enter the request goes to /request?password=password instead to /smserver/request?password=password. Changing the line 71 gatekeeper.html to var url = window.location.href + 'requests?password=' + input seems to solve the problem. The chat window doesn't load because there are some other line need to change.

itsjunetime commented 3 years ago

Alright, I've played around with some things and got it running fine behind a reverse proxy (with the websocket working as well). I have to test this version more, but I'll hopefully be able to release version 0.7.0 soon with support for running it behind a websocket, with instructions for how to set it all up.

itsjunetime commented 3 years ago

Alright, try out version 0.7.0 and see if you can get that to work. I also included details here to explain what worked for me to run it behind a proxy.

Andi-bz commented 3 years ago

Ok the reverse proxy is now working. The auto update of the interface isn't working anymore if the ipad is in standby mode.

Thank you

itsjunetime commented 3 years ago

So, just to clarify, the server works just fine and new texts show and battery percentages update when your iPad screen is on, but once you turn the screen off, it stops automatically updating and you don't see new texts or battery percentages?

Andi-bz commented 3 years ago

Yes the server works fine. If the iPad is ON new messages appears. After the iPad goes in standby I have to press F5 to view new messages. It seems not related to the reverse proxy. Should I open another bug report?

Thanks

itsjunetime commented 3 years ago

Could you try an ldrestart real quick to see if that fixes the problem? I notice that similar things happen to me sometimes, and an ldrestart fixes it.

Andi-bz commented 3 years ago

No ldrestart doesn't fix the problem. When I am connected via ssh it works

itsjunetime commented 3 years ago

Alright, it looks like some other people are reporting this problem to me as well, so would you be able to open a new issue for this with the all the details, and close this one? Thank you!

Andi-bz commented 3 years ago

Ok. Thank you.