MTK
MTK

Reputation: 3580

devTools remote debug device port forwarding other than localhost

I need to connect from one android device (galaxy TAB) to my developing PC via (USB) -> chrome://inspect/#devices -> port forwarding

In other words I want to open in my galaxy TAB a chrome page with one of mi sites hosted in my PC

In my pc I have multiple virtual host eg: localhost, site1, site2 ... all with SSL port 443 and self signed certificates

I have also edited in my PC C:\Windows\System32\drivers\etc\hosts so each site have 127.0.0.1 like IP

In summary: from my PC I can access all these sites without any problem


Now I need to connect those sites on my PC from my galaxy TAB via USB


If I have tried port forwarding in devTools 8080 -> localhost:443 Everything OK. I can see my PC localhost on galaxy TAB

But if I try port forwarding in devTools 8080 -> site1:443

I got ERR_NET_TIMEOUT and never connect to site1, site2 etc

I have also removed temporally all htacces files to avoid others interferences ( so in localhost I can see INDEX OF files but in others virtual domains NO)

Upvotes: 0

Views: 961

Answers (1)

MTK
MTK

Reputation: 3580

I solved it like that:

  1. I have configured a proxy connexion in my android device see : debugging-local-server find Configure proxy settings on your device on the anterior link

Then I found another problem (seem to be a bug ... only for SSL) access to localhost still to be OK but site1, site2 etc return ERR_EMPTY_RESPONSE even if I put a simple index.php with echo "OK";

Then I made this workaround:

  1. in httpd-ssl.conf I have changed DocumentRoot from localhost directory to my/path/to/site1

after that when I put https://localhost:8080 in my android device for debugging I got content from site1 instead of the old localhost

Take care also if your script depend on absolute links like https://site1/something_else you must change all from site1 to localhost or use htaccess with mod_rewrite

Conclusion

So even if this workaround it work, still a bug with proxy and SSL. In this case I have removed proxy configuration (from step 1) because debugging localhost with SSL work without needing a proxy configuration

Sorry for my English!

Upvotes: 0

Related Questions