I am looking for a proxy server that can do this.
If I set my firefox settings to that proxy, and go to google, then it should "proxy" to google normally. Just a normal proxy.
But I want there to be rules. I want to redirect anything that matches http://google.com/... to http://12.34.56.78/...
I was thinking about writing one but to be honest there has to be something to do this already built.
Fiddler should do what you want. If you type into the black box at the bottom "overridehost google.com 12.34.56.78" it should redirect any Google requests to the specified IP.
Not a proxy per se, but what about editing your local host file? If you are a Windows user just go to "C:\WINDOWS\system32\drivers\etc" and edit the "hosts" file accordingly. Eg. add a new line:
12.34.56.78 google.com
I know the use is limited, because you cannot make more complex redirects. However it might be sufficient for your problem. Good luck! (on linux/unix the file is often located in /etc/hosts).
If you want a better solution, it would be helpful to give us your OS.
Related
At work we have a series of aliases for websites like repositories etc. and they are used by typing something like open/repo in the browser.
I wanted to create something like this at my private PC and found out I could add a line to /etc/hosts file and it looks like this:
172.217.16.46 gl
Now what I would expect is to type gl in any browser and it would redirect me to google.com, but unfortunately I get 404 errors on every browser. The only answers I found were browser specific, like this one for Chrome, where other browsers actually work as expected.
What I tried:
I've run ipconfig /flushdns in cmd (on admin rights)
I put http:// before the alias in Chrome
Note:
I would like to keep all the changes locally on my machine (without changing router configuration etc.)
If you are getting a 404 error, the problem is probably not that DNS resolution is failing but that your address is wrong. It sounds like you have tried to point gl to Google's IP. That would cause your request to hit Google's server, but Google will probably reject it since it is labeled addressed to gl instead of google.com in the HTTP request.
This phenomenon happens because it is common for web servers to host different websites on the same IP only with different domain names. I believe the term for these is "virtual host".
At any rate, try pointing to an IP that takes any name to access the website, or otherwise you are probably looking for some kind of redirect instead of A record DNS.
If I use foo.my-company.com at work, then all works well, but if we fix any bug remotely, then the web server will respond with a forbidden.
I heard we can use dev1-foo.my-company.com at a remote location, and it is the same site, but if I access that, I found that all the AJAX are still done to foo.my-company.com and it won't work because it is still forbidden. It seems that "hosts file" can be used to overcome this, but how specifically?
All a hosts file can do is associate a hostname (like dev1-foo.my-company.com) to an IP address (like 10.1.1.5).
This can be enormously useful if:
Your DNS doesn't have an entry for the host you need (e.g. "dev1")
... or ..
You want to override DNS (substitute your own "dev1", e.g. for testing)
This is all TCP/IP - it has nothing directly to do with higher-level protocols like HTTP or AJAX.
'Hope that helps ..
I'm facing an little issue here. At the place I live, they shape the download speed by extension (using delaypool). Is there any script that I can run on my web that will let me enter the URL of files that I wanted to download, then it will download the file and rename it to "originalfilename.abc" (because .abc is not shaped)then save it on my web where I can download it. By the way, I have a paid webhosting service.
Thanks
I tried the SSH (my web hosting does indeed provide me with shell access) but all I get is a blank page in my browser. No error. Please advice.
Also, reason I choose script on the server instead of SSH because I though that SSH would be slower than direct HTTP download from my webserver. Can anyone point that out if I'm right or wrong with my thinking.
Thanks
You can write a vbs script or even batch file script that will go to a designated URL, and then download the file, then rename it. Then you can script FTP commands to upload to your webhosting service (I'm sure it has an FTP site for access). You could load this as a scheduled task, or run it manually.
I'd do either one of these routes.
A simpler (once its set up anyway ;) option I can think of is going through a secure tunnel. Whilst this is not quite answering your question I believe this to be simpler while achieving the same thing.
Get an SSH Client (Putty) and get a free Proxy. If your web-server has an SSH-server you can use it as Proxy as well of course, I am using my modified router at home as proxy via DynDns, but the Tor-Network will work, if very slow, so do other official free and paid proxy servers. If you are using an application to download that does not have the option to specify a proxy, get Proxifier Portable.
Use Putty to create the tunnel. Here some how-tos:
http://oldsite.precedence.co.uk/nc/putty.html
http://www.techrepublic.com/blog/security/use-putty-as-a-secure-proxy-on-windows/421
http://kimmo.suominen.com/docs/proxy-through-ssh/
And set your application to use your proxy (or actually to use putty which connects via SSH to your proxy) by entering 127.0.0.1:1080 into the proxy settings. Alternatively, if the app does not have an option to enter proxy settings, add 127.0.0.1:1080 to your Proxifier proxy list and add the applications that are supposed to use that connection to Proxifier.
Now you can do pretty much everything without anyone eavesdropping your connection stream being able to tell what it is, as the connection stream is SSH encrypted. This includes surfing websites that your provider/company/mother has blocked, download anything - even if blocked by IP/name/whatever-filters and even play MMORPGs from work (something which I do not recommend because it will get you fired and there is always some way for someone to figure it out, just saying it is possible to do even in secured company/school networks as Port 22 (SSH) is usually one of the 2 Ports which are open on pretty much any network (the other one being port 80)).
Its a wee bit of a pain to set up. Once it is working though, you can even put it on a usb-stick and use it pretty much anywhere as long as you remember what proxy to connect to. And you wont have to rewrite scripts to try to circumvent the delaypool thingy.
Say I have a site hosted on example.com, now I want each of my registered user to get a personalized sub-domain, e.g Alice should normally gets alice.example.com as her sub-domain. While actually alice.example.com gets data from example.com/user/alice. How to implement this mechanism? I see lots of sites are working in this way. I wonder how they did it. Is it some kind of domain server configuration, web-server configuration, .htaccess rewrite or simply some tricks in the code?
If its redirecting, as I experimented, example.com and alice.example.com will get DIFFERENT IP addresses, if that, how rewrite works since when I request alice.example.com, the web browser takes me to a completely different site (IP address).
This has confused me for some time, I just can't figure it out myself, any help would be really appreciated.
[edit]: OK WAIT! I'm afraid I made a duplicate. Check this thread: Create subdomains on the fly with .htaccess (PHP)
Basically you need two parts:
1) Your Nameserver needs to support wildcards. So you would map *.mydomain.com to a single server. This will cause alice.mydomain.com and bob.mydomain.com to all go to the same server.
2) Then your server software should be able to map the hostname (=alice.mydomain.com) to your application and pass in the "alice" part as a parameter.
Depending in what framework/server software you use this should be quite easy.
HTH
Alex
Is it some kind of domain server configuration, web-server configuration, .htaccess rewrite or simply some tricks in the code?
It's probably a combination of the several techniques.
First layer would probably be a Wildcard DNS record on a DNS level so that any sub-domain can be used.
Next, server configuration or application logic is used to separate the content based on the accessed sub-domain. This can be Apache Alias directive or a Rewrite rule or logic in your application code.
I can tell how I did this on pastebin.com
wildcard DNS makes *.pastebin.com go to a single IP
By default, if Apache can't find a matching vhost for a given domain, the first defined vhost picks it up (there are other ways of achieving this, this is just what I did).
So I ensure the pastebin site is the first vhost, and so then software then sees the requested hostname and acts on it accordingly to configure itself
For example, I have a development site on a different server but I'm trying to copy content over from the live site so it'd be handy to have the live site in IE and the dev site in FF.
I tried FoxyProxy but I can't seem to get it to work.
I use this to override system's DNS with localserver
in about:config
change this value:
network.dns.forceResolve
network.dns.ipv4OnlyDomains
network.dns.localDomains
with IP address of local DNS server (for exsample 192.168.1.88)
Sorry for my english
It's now possible, with the DNS over HTTPS function:
Open Options, General, scroll to very bottom and open Network Settings,
On the very bottom, you can find DNS over HTTPS:
You had to use about:config before to change this setting, here's for documentation:
Type about:config in firefox address bar.
search for:
network.trr.uri
You can use one of the DNS servers below:
Cloudflare: https://cloudflare-dns.com/dns-query
Google: https://dns.google/dns-query
Secure DNS EU: https://doh.securedns.eu/dns-query
Quad 9: https://dns.quad9.net/dns-query
And set network.trr.mode to 1
Hijacked from here:
https://www.ghacks.net/2018/04/02/configure-dns-over-https-in-firefox/
It appears from your question that you already have a second set of DNS servers available that reference the development site instead of the live site.
I would suggest that you simply run a standard SOCKS proxy either on that DNS server system or on a low-end spare system and have that system configured to use the development DNS server. You can then tell Firefox to use that proxy instead of downloading pages directly.
Doing it this way, the actual DNS lookups will be done on the proxy machine and not on the machine that's running the web browser.
DNS resolving is usually done at the system level and not at the application level, so you can't normally have one program use one dns and another program use a different dns. I'm not aware of any firefox extensions that allow you to use a different dns.
What about having different names for your dev and prod servers? That should avoid any confusions and you'd not have to edit the hosts file every time.
I am using the SwitchHost extension exactly for this problem:
https://addons.mozilla.org/en-US/firefox/addon/14258
It is easy to configure, and even more easy to switch hosts.
I wonder if you could write a custom rule for Fiddler to do what you want? IE uses no proxy, Firefox points to Fiddler, Fiddler uses custom rule to direct requests to the dev server...
http://www.fiddlertool.com/fiddler/
Since http proxy protocol is similar to raw http protocol, you can redirect desired traffic to your development server by telling firefox it's a proxy server.
two limitations:
A. this won't let you use https connections.
B. some frameworks (e,g: wordpress) don't like this method and redirect the request the wrong way
just copy the following code into a .pac file (enter your site domain and IP address, of course), and switch development/production just by changing proxy configuration.
function FindProxyForURL(url, host) {
var prox4site = {
"mysite.com":"PROXY 10.0.1.100:80",
"www.mysite.com":"PROXY 10.0.1.100:80"
}
return prox4site[host] || "DIRECT";
}
Go to options->Advanced->Network->Settings->Automatic proxy configuration url and enter 8.8.8.8 All you Mozilla traffic uses Google dns now.