简体   繁体   中英

Redirect from localhost to external url

I want to redirect a local port door to a website. So that when I access https://localhost:8080 it actually loads (or redirects) https://www.facebook.com , or something like that.

I'm on a windows machine. I already tried changing the file C:\\Windows\\System32\\drivers\\etc\\hosts but it did not work.

I only found solutions of the other way around. Does anyone know how to do this?

Thanks in advance!

You can use a reverse proxy to implement this feature. The data flow would look like:

Browser -> localhost:8080 -> proxy server that listen port 8080 on localhost -> proxy server sends request to example.com -> proxy server receives response from example.com and return to browser -> Browser

This reverse proxy can be programmed manually, or by using HTTP proxy software, such as Charles :

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM