PhpStorm remote development access to remote http with browser - docker

I setup remove development with PhpStorm - works fine. But how can I connect to the website provided with remote machine?
Is it possible to make some proxy / tunnel or something ?
On the remote host I have docker containers that provide hosts like http://myapp.demo.
i see in /etc/hosts on remote i have
172.25.0.3 myapp.demo
so its local subnetwork for remote.
When i create proxy its not accessible for local.
Also i try ssh connection with -X forward and try run browser example firefox but get
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
Error: cannot open display: localhost:10.0
So remote desktop like vnc only way ?

Since 2022.3, you can forward ports in Backend Status Details:

Related

Can't connect to docker container running minecraft server online

So I've been trying to host my own Minecraft server for a while now and I hit a snag.
I have proxmox (192.168.2.100) running an ubuntnu server VM (192.168.2.101) which has a docker container running my Minecraft server. I can connect to the server locally just fine using the ubuntu's IP address and minecraft port, but when I try to port forward the server, I can't connect to it. I checked to see if my port was exposed or not and it is so I know it's not that.
This is the container that I'm using
Okay, so after a long time looking at configurations and some help from the proxmox forum, it turns out that my modem doesn't support NAT reflection which means that any attempts to access my server though my public IP on the same network wouldn't work at all. I used my phone's mobile network to test if I could access the server from outside my local network and it worked just fine!

Cannot access webserver after ovpn client connected (on the server) to a remote network

I have a cloud VM (debian 11) where I run some docker stuff. I have an nginx for reverese proxy, and some web application behind it.
I protect the webserver with cloudflare. I already set up the origin cert, and its works like a charm. When I reach the nginx its use the cf cert ..
BUT, I have to reach this server from my home and from the internet. I have a mikrotik router with ovpn server, and when the cloud server is connected to my network, nginx doesn't to serve web request through cloudflare. :(
When I run systemctl stop openvpn on cloud server, the webserver is reachable again. (when openvpn is connected, I can connect to nginx on private ip, but not from cloudflare.)
Do you have any idea what's happening?
The ovpn server is accessible in port 1194 on my mikrotik router.
The nginx is reachable in https://domain:443 when ovpn client is not connected. When connected is not reachable.
I was able to resolve this issue.
I had to comment out the redirect-gateway line from clinet.conf. Now everything works as I expect.
I can reach the server through openvpn and the server is reachable from the internet.

Get client source IP on docker for Windows

I have a docker container running on a Windows Server host, it has a Java app running which communicates with remote client bidirectionally, when the remote client communicates with my server it gets the Docker gateway ip, 10.1.0.1 instead of the remote ip;
It only happens on Windows host, with an Ubuntu Server host it works without any trouble, I get the remote client ip, which I need to answer the petition.
Things I tried:
Disable ip masquerading from docker-compose.yaml file with;
com.docker.network.bridge.enable_ip_masquerade: 'false'
Disable ip masquerading from daemon.json with;
"ip-mask": false
This is how I create the network on docker-compose.yaml;
Nothing of these two solutions worked, thanks in advance.

VSCode combine remote ssh and remote containers

On my office desktop machine, I'm running a docker container that accesses the GPU. Now, since I'm working from home, I'm connected through ssh to my office desktop computer in vs code via remote ssh plugin which works really well. However, I would like to further connect via remote containers to that running container in order to be able to debug the code I'm running in that container. Failed to get this done yet.
Anyone has any idea if this is possible at all and in case any idea how to get this done?
Install and activate ssh server in a container.
Expose ssh port via docker
create user with home directory and password in container
(install remote ssh extension for vs code and) setup ssh connection within the remote extension in vs code and add config entry:
Host <host>-docker
Hostname your.host.name
User userIdContainer
Port exposedSshPortInContainer
Connect in vs code.
Note: Answer provided by OP on question section.

Testing box application from virtual machine

Box requires you to use HTTPS for any URL other than localhost. Unfortunately, I developed on a Linux virtual machine running inside a Windows machine, and I want to access the server running on Linux from a browser in Windows. Therefore, I cannot use localhost.
Is there a way that I test out my box application without needing to create a certificate on my Linux machine?
Yes. You can use an SSH tunnel.
Set up an SSH server on the Linux machine (make sure you secure it if it's accessible from the Internet)
Use a Windows SSH client (like plink or cygwin's SSH client) to create a tunnel to the desired port (80?) of the Linux box. For example, if you're using plink:
C:\>plink.exe -L 1234:127.0.0.1:80 <username>#<Linux machine IP>
using cygwin, the command would be the same:
$ ssh -L 1234:127.0.01:80 <username>#<Linux machine IP>
This will establish a tunnel between the Windows machine's local port 1234 (127.0.0.1:1234) and the Linux machines port 80 (127.0.0.1:80). So if you open a browser on the Windows machine and point it to 127.0.0.1:1234, you'll really be connecting to 127.0.0.1:80 of the Linux machine.
There are some nice tutorials on SSH tunnels, but make sure you're reading about the right type of tunnel. They come in 3 forms - Local (-L), Remote (-R) and Dynamic (-D). You need the local one.
To debug the tunnel, you can use nc. Use something like nc -l 127.0.0.1 80 to get nc to listen on 127.0.0.1:80, then try using the tunnel from the Windows browser. You should see the HTTP request in nc.

Resources