How does smackaho.st work? - apache

It basically sends everything you throw at it to your localhost. Is it possible to do this with apache server and .htaccess? Its also what I used as a callback url when I was developing using twitter's API. So I'm curious. http://smackaho.st
Thanks

There is no HTTP server involved here at all. The DNS A record for smackaho.st is 127.0.0.1, which refers to your own machine.
Using that name as a "callback url" probably won't work at all, since when Twitter tries to contact smackaho.st, they'll get 127.0.0.1, which refers to their own machine (not yours).

Related

What would cause apache to redirect from a local IP to a remote IP address

Here's a scenario that I can't figure out; I simply can't understand why an slightly oldish webserver (totally inactive/powered-off for 2y) is behaving this way. I MUST be overlooking something quite simple.
Specifically, when i try to access an Apache instance on Centos 7 residing on my local network (192.168.2.XXX), the apache page responds just fine (Testing 1,2,3; Yay). Watching the access logs on this simple request shows up fine. On this same machine, I have four additional paths set up. One for example is a locked down phpMyAdmin that is accessible only from an internal IP. This route works fine, and the databases can be browsed, etc. Yet, for the other route, such as a wordpress installation or a route to a Magento instance, the the request comes up on the access log (no error log entry), and then just sits there. When the request finally times out, the URL in the browser changes to a new ip address (ABC.XXX.YYY.ZZZ), and then terminates any efforts.
Admittedly, the machine WAS originally configured to be outward facing, and my suspicion is that the IP to which the pages revert may have been the public IP last time the machine was alive. the IP is no longer associated with the site, and the domain which was likely setup with that IP address, is also no longer active.
Does anyone have any suggestions as to what I may look at? I have combed the httpd configurations and there is nothing resembling any such redirection address. Could there be some DNS data that needs to be flushed? A network configuration in sysconfig/ that I am overlooking?
It was nothing to do with my apache configuration. Everything was related to the site urls that were embedded inside the wordpress and magento installations. Upon finding and replacing all instances of the site IP address in some configuration tables, I was able to get both applications to respond properly.

get hostname of remote clients accessing my website using vb.net

I have a Vb.net based website which is a pretty old one can't upgrade it.
I need the hostname of the clients visiting the website.
On page load of the login page I am calling using this which gets me the client's hostname who's accessing the website.
System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST")).HostName
I am logging the details into my Database which is similar to the below
172.xx.xx.xx ltp-017 RUPESH
I have no problem catching the IP address and hostname of devices accessing my website from home network but when a device(including mobile devices) is accessing from outside my home network the above code does not catch the hostname.
Is there any other option or programming language which I can use inside my VB.Net to achieve this?
Any ideas to get this work is much appreciated.
Thanks for your time in advance.
Request.UserHostAddress gives the IP of the connected remote client.
https://learn.microsoft.com/en-us/dotnet/api/system.web.httprequest.userhostaddress?view=netframework-4.7.2

Charles Proxy - Map remote to localhost from https to http

I'm trying to use Charles to map requests for my server to localhost on my Mac.
The server is on HTTPS and the local is HTTP.
I'm trying that from the Chrome browser, iOS simulator and Postman.
it always fails.
I set map remote in charles from my-server.com/* to http://localhost:PORT.
If I try https://my-server.com/, charles maps the request but I get error in CONNECT request.
If I try http://my-server.com, the request succeeds.
EDIT:
There is an answer that suggests rewrite instead of map remote. it is good and working, but it feels to me as a workaround. I would like to use map remote as usual. I guess it require both Charles setup and machine setup
You should try using the Rewrite function like this:
As #kubano suggested, I'm using REWRITE tool with URL rewrite.
In order to map all subpaths, I'm using regex group to replace the hostname but re-attach all that comes after '.com'.
When wrapping something with () it is referred as 'group' and you can use it with $1 $2 ... and so on. in this case, what ever comes after '.com' is referred as $1 in the replace section
I suggest using Map Remote from Proxyman to map between HTTP <-> HTTPS which is easier to setup.
Just create a rule, set HTTPS to HTTP, and the host. It will map from https://your-server.com to http://localhost:3000
Doc: https://docs.proxyman.io/advanced-features/map-remote
Disclaimer: I'm the creator of Proxyman and hopefully it would help you.
In case somebody comes here to search for how to map local (file) from an https location (which did not work for me out of the box):
Similar to the rewrite rule (in Charles 4 at least) it works with map remote, mapping https to an http location (e.g localhost) and then mapping that (localhost) url to a file

Can't access my website after trying to move it to another server

I want to move my website to my new virtual server that I bought from another service provider.
I installed Apache Webserver, created a virtuzal host for the website and I changed the DNS in my actual service provider's admin panel pointing to the new server's IP address.
I then realized that I can't access mysql to export my database and I disabled the domain on the new server, changed the DNS back in my old admin, but now I get a ERR_CONNECTION_REFUSED when I try to call the website.
I don't find anything on Google, because everybody wants me to delete browser cookies (which I did), but that doesn't help.
What can I do for getting back the old website and being able to export my MySQL database?
It may well be that your DNS records are still propagating and you need to wait. Try adding an entry in your hosts file to point to the "old" site URL and hit it in your browser. If it works then it's the DNS not completed propagating. Otherwise your error looks like an Apache issue not a MySQL issue.
I simply deleted the virtual host on the new server for the domain and I was able to access the "old" site immediately.
It's still possible, that the DNS just finished propagating, like #George said, but it's very unlikely.

301 web forwarding on main domain - Can subdomain point somewhere else?

Excuse the potential noobishness of the question, but I'm, well, a bit of a noob when it comes to this domain architecture lark. If "domain architecture" is even the technical term. Anyway, I digress...
So, I've googled this question , but I can't see the answer I'm looking for (maybe it doesn't exist, who knows!?) The situation is that I host a .com top level domain which does a 301 forward to another site on the net not hosted by me. Can I set up a subdomain that then points somewhere else whether that be on my host itself or just some other site elsewhere on the net?
Essentially, if I set up a subdomain, will it too inherit the web forwarding, and if so, can I directly affect where that subdomain points?
Any answers gratefully appreciated!
Before I try to answer your question, let me be a little fussy :)
First thing first you are confusing and mixing together two different protocols ([DNS] and [HTTP]), actually there is even a dedicated page to the Wikipedia for HTTP 301 responses: http://en.wikipedia.org/wiki/HTTP_301 (but you should read the whole shebang: ([Wikipedia, search for HTTP] is always a good start, and the [RFC 2616] is absolutely a must, IETF RFCs are not easy reading but the Internet is built on them).
DNS is used to translate a name, like www.example.com into an IP address, like 192.168.0.1, in order to locate a machine on the Internet. So DNS is involved as the one of the very first steps a browser takes in order to resolve an URL: but once the "machine name" is translated by the separate DNS Service, and it has become an IP address, DNS job is over and it is used/involved no more.
Then when a browser, using HTTP, contacts the Web Server located on that machine (in this example the machine www.example.com, which the DNS Service has kindly translated to an IP address, in our example 192.168.0.1, because the operating system can only use an IP address as the argument for an [internet socket]) and only at that moment the web server, instead of serving a page, answers whith an "error" code (which, actually is a "response header" with a numeric code that does not start with "2").
Only that this error code is actually used to tell something else: that the browser should try again an "HTTP request", this time connecting to another machine (and, as long as this redirection is "permanent" instead of "temporary" ([HTTP_307]), the new address should be remembered by the browser, its cache and history).
So, if you can setup [redirection response header] on the first machine, it means that there is a Web Server on that first machine that is programmed (given a certain URL pattern) to spit out a Redirection Header, and as long as you can control these redirections, you can as well send the browser wherever you want, not merely sending them to another machine on the Internet but to another URL as well, even on the same website (actually this is the original intended use of code 301, as a measure against [link rot]).
Basically you are free to do whatever you want, or better, to send them wherever you want.
The pros are obvious... the cons are that you must have control over the first web server, and that the visiting browsers will have to perform two "GET request" in order to land at the intended page (this is not grim as it looks, since the [RFC 2616] suggests that the browser (they call it User Agent) caches and remembers the redirection (because it is
permanent)).
Disclaimer: I am being prevented to post hyperlinks, but they where basically all from the Wikipedia so, if you will, you can look the words in brackets "[...]" on the Wikipedia...