Have Apache send alert on 404 from same server? - apache

To guard against broken links on my servers, I thought it would be great if I could configure Apache to detect them automatically when someone clicks on them and then alert me. Is this possible? What I was imagining is that when a 404 occurs, it checks the referrer and if that is the same server, sends out an alert (for example an email).
I've searched for this subject, but everything I can find is either just about logging and does not address the referrer part, or is unanswered. I guess there are two major components to my question:
Can I configure Apache to check the referrer and take some action when it is the same server?
Can I configure Apache to send out an alert on certain conditions, e.g. by sending an email?

Related

react-native-webview: is there a way to determine when we are done redirecting (with multiple redirections)?

Using react-native-webview, I redirect my users to an URL that will redirect to other URLs that will all redirect, multiple times.
I don't know how many redirections there are, or even the end-URL.
Is there a way to know when the webview is done redirecting?
You could send a message from the end-URL to your server when the client lands on it, which idicates that the website is done redirecting. If you don't own the URLs where your client gets redirected to, you must know how many times the client gets redirected, so you can calculate a time-astimate with the default ping of the client plus a buffer...
Something like that: done_redirecting = avg_ping * redirecting_amount + buffer
Please note that this is pseudo-code and theoretical.

Can I use vb.net to interrogate a website to know if it uses SSL

I have a program that asks the user to type in a URL, and click download. Then the program downloads the webpage.
However, some websites use SSL, and in that case the user has to prefix his URL with https:// for this to work.
The problem is that the user may not know whether the website uses SSL, and may type http://... instead of https://....
Is there some way to send a preliminary message to the website (from vb.net) asking whether the URL should start with https or just http? If there is, I can correct the user URL before attempting to retrieve the web page.
(I should say there it is not enough to use something like this:
request.RequestUri.Scheme - this looks at the URL the user submitted, not the URL coming back from the server, as far as I know)
For websites that uses SSL, usually they will force the request to use HTTPS. That is when you send a request in HTTP, for example, http://www.example.com, the website will send a redirect response with HTTP status code 302 as well as the URL the client side that initiate the request should redirect user to.
So, you can try HTTP first and check the response to see if there is a redirect. So, you will need to handle that in your code.

Getting 411 Response for http GET request on cloudflare URL

Our website uses cloudflare as it's CDN to handle loads.
One of our apps requests the URL http://www.codenameone.com/files/cn1libs/CN1JSON.cn1lib with a get request. This works fine for every machine/location we tested but we have user complaints that they are getting an HTTP 411: "Length Required" response.
Since this is a GET request content-length doesn't seem like a header we would need to send...
Our server logs don't show any 411 response so my only conclusion is that this is a failure on the cloudflare side. However, since we can't reproduce this and the cloudflare aspect is a black box I don't have much to go on in terms of debugging.
I tried contacting cloudflare support but effectively got the usual "run around" asking me to send traces from a users machine on the other side of the world which is not something I can realistically do.
After a long session with cloudflare support it seems that unless you are an enterprise subscriber log files for access just don't exist. So effectively their support sees cloudflare as a black box just like we do.
Since the problem clearly isn't in our servers my educated guess is that this is a bug in cloudflare related to some odd edge case.
If someone has a better answer than this I'll gladly accept it.

Changing request and response with an Apache Proxy Server

I want to use an Apache proxy server (mod_proxy) to intercept all requests and responses to a web server. However I want to change requests and responses before redirecting them. Simply rewriting URLs is easy and documented, but the changes I want to make are more sophisticated, namely they need to inspect the request for user credentials as well as conditionally make redirects.
Is this possible in Apache's mod_rewrite, possibly in combination with other modules?
While the main goal is to implement this in Apache, I would also be happy with an alternative solution which doesn't necessarily use Apache.
Here is a more precise explanation of what I want to achieve, to give a little more context:
Check each incoming request for user credentials. If credentials are present, they are replaced by the user information which the web server can use to identify the user (Ideally in the Authorization header)
For example, let's assume a request contains a cookie which authenticates the request as beeing sent from the user "John", this cookie is removed, and the Authorization header is changed to Authorization Authenticated_by_proxy {"id":12345,"name":"John"}
Check each answer to see if it's an Error 403. If this is the case and the user is not logged in, redirect the user to a login page instead of forwarding the error

Unregistered domain heiiehdsx.com in my referrer logs

Lately, the unregistered (available) domain heiiehdsx.com has been showing up in my HTTP referrer logs. It comes from a variety of IP addresses (none very similar). When I Google the domain, the only results are reports of it appearing in other server logs as well.
Anyone have any idea what's going on here?
Looks like a spoofed header.
Most HTTP headers can be very easily spoofed.
FireFox even has an add-in for modifying headers.
Chances these are from a bot/spammer that is looking for vulnerable targets.
This is referer spam. Bad guys trying to provoke you to visit their websites.