FICTURE7 / uberstrok

An effort to write an UberStrike server emulator.
MIT License
12 stars 10 forks source link

Gameserver Guide: Workaround for those who can't get WebServices to access in the public #34

Open MeloriTensei opened 5 years ago

MeloriTensei commented 5 years ago

Requirements: -Apache Server (can be your own or from XAMPP, as long as they work) [Mod: mod_proxy] -Uberstrok (duh~) -Knowledge of port forwarding (because port 80 will be forwarded through the router) -Common sense (or just lose your sanity XDDD)

Presumably, the webservice refused to get to the public because it is stuck on localhost, which is what I faced in the process. I've did some research on a workaround for this. I didn't want to host Uberstroke WS on port 80 because my Apache web server is on port 80 and it would clash. So, I thought: why not host on other ports on localhost BUT have Apache to REVERSE PROXY it.

To begin, we need to make sure that the service_base line in main.json file, you set the domain to: http://localhost:82/ (or whatever port that is other than 80 because Apache is gonna use 80)

1

(Friendly reminder: Remember to set the game and comms server in the servers.json file to your external ip like usual, or even dynamic hostname if you prefer)

<THIS SECTION IS FOR NEWBIES, APACHE EXPERTS CAN SKIP THIS XD> For newbie's knowledge, Apache is a web server famous for easy setup and config through simple text based .conf file. It is capable to do various things a normal web server could do. Which one of them is reverse proxy. Reverse proxy is basically a process where Apache becomes the "middle-man" for transferring data to clients from a particular server that is within local network and don't wanna be individually exposed through the traditional port forwarding. Being a coincidence that the Uberstrok Web Service is stuck on localhost, this is the perfect solution. image

Install Guides: Click here for the super simple guide to setting up an Apache server through XAMPP, a GUI server control panel. You may stop once you've reached the installed step. or if you wanna do HARDCORE, you may follow this guide here

After that, go to the httpd.conf file and enable the following mods required by removing the hash behind it then save: LoadModule proxy_module modules/mod_proxy.so

Now :), you should be ready to continue. Continue below! :D </APACHE EXPERTS, HERE IS WHERE WE CONTINUE>

If you happen to have a virtual host (or newbie's words: web site) hosted on the root domain (www.example.com), then you'll want to follow the same train as I am as I ALSO have a website up on the root domain.

To do this, open up httpd-vhosts.conf (from the extra folder) or httpd.conf (on the root of conf folder) and add in this following line at the end and save:

##  _    _   ____    ______   _____     _____   _______   _____     ____    _  __
## | |  | | |  _ \  |  ____| |  __ \   / ____| |__   __| |  __ \   / __ \  | |/ /
## | |  | | | |_) | | |__    | |__) | | (___      | |    | |__) | | |  | | | ' / 
## | |  | | |  _ <  |  __|   |  _  /   \___ \     | |    |  _  /  | |  | | |  <  
## | |__| | | |_) | | |____  | | \ \   ____) |    | |    | | \ \  | |__| | | . \ 
##  \____/  |____/  |______| |_|  \_\ |_____/     |_|    |_|  \_\  \____/  |_|\_\
##You can ignore the ASCII text above, this is how I organize my virtual hosts XDDD
##The lines below are the real ones :D
<VirtualHost *:80>
  ProxyPass /2.0 http://localhost:82/
  ProxyPassReverse /2.0 http://localhost:82/
  ServerName uberstrok.example.com
</VirtualHost>

NOTE: Change example.com to your web domain. If you use noip or any free DDNS service that only provided you a subdomain, you may need to either ditch your website and use it for Uberstrok or just host this reverse proxy on other ports.

Launch the Uberstrok Web Service and the photon server, then launch Apache server. If you run into issues relating to Apache, please consult "Mr. Google" for assistance (there's a large community that can help).

Now, change the address on your .uberstrok file (and maybe your friends as well) into the following: http://uberstrok.(your address)/2.0/

And enjoy :)

Anjum9694 commented 5 years ago

No-IP has a port 80 redirection service.. You can run apache server on any port and still connect via port 80 externally. Just writing it down in case if it's any help.

MeloriTensei commented 5 years ago

@Anjum9694 It's good to leave a small info. The case scenario for my workaround is most likely for those who use Cloudflare, which at many times fails at tunneling at any other ports LISTED supported on the http port for my case. (Not sure where I've done wrong lul)