Forcing internal server errors in IIS - iis

Might seem like a strange question. But I want to be able to force 500 internal server errors (not errors with my code, but error 500 IIS).
Any sure bet way to do this?
I need to be able to test how other systems react that are connecting when the server returns Internal Server error 500.
I saw this question:
How to force IIS to throw an exception
Problem with this is I can already do this. If I do it this way, I have more control than with the IIS internal errors. Or at least I think I have more control.
I don't want to mimic a 500 error. I need to be able to see all the aspects of the 500 error IIS returns (content, headers, etc).
The purpose is that I need to be able to CHANGE those things if possible. And know I changed them.
One example of what I need to do is set a short cache time for these internal 500 errors (without affecting other responses).

This worked for me, I configured IIS limits to zero connections. Any requests gives
HTTP/1.1 503 Service Unavailable\r\n
Not exactly what you asked for, but perhaps close enough?

Related

How to configure lighttpd display custom 500 error page?

When my php works not correctly, server sends 500 error to browser by default. I want to see my custom error page. I tried to use servererror-file prefix, but not work with 500 error.
In lighttpd 1.4.46 (not yet released), you can choose to intercept errors from dynamic handlers using server.error-intercept = "enable". See https://redmine.lighttpd.net/issues/974
However, a better solution is to trap the errors in your PHP script and issue an appropriate error page, rather than crashing.

IIS fails with 500 response code

I've faced with request (/[13:49:32]:й) that leads IIS to fail with 500 error. It contains non-ASCII symbols so I've expected that disabling High Bit characters should fix it but it doesn't. It seems that [13:49:32] part influences on rewrite module or something else since it tries to load web.config file from another location (\?\E:\sitesroot\0[13:49:32]:й\web.config).
I'm not an expert in IIS but as I understand from poor search results and that stackoverflow also has such issue https://stackoverflow.com/[13:49:32]:й it is not a well-known issue. So I need some help from IIS guru to fix these errors (replace them with 400).

Why Server header in not getting removed from the response in 500 error?

I recently scanned my application for the vulnerability, got minor fixes but for one of them I tried hard still not able to fix. For some operation my site throws 500 error and when I check header of that error, it is having server header named IIS 7.5. I have already used URL rewrite rule,registry fix,URL scan thing, but seems to be nothing is working.How to fix that ?
If you mean the Server HTTP header, which will probably be set to something along the lines of Microsoft-IIS/7.5 then the easiest way is to overwrite it with a blank or custom value in IIS. You can remove it completely by creating your own HTTP module. The following link discusses the manifold methods you can try:
http://www.dionach.com/blog/easily-remove-unwanted-http-headers-in-iis-70-to-85

IIS 404 Error even when file exists?

I have been working with IIS 7 for a while and it has worked fine until it just suddenly started throwing 404 errors for my multiple websites even though they actually exist. All of the configurations seems fine (path, default document) but not a single file, no matter the format or location will be loaded.
Another strange thing is that everything works when I try to access the websites via localhost or 127.0.0.1 but not through my external IP.
Does anyone know why this could happen and how I can fix it?
Edit:
It appears this 404 page is not the built in IIS error page. It is associated with nginx but I'm not sure where the file is located on my server or why my pages are being intercepted.
It turns at the server was hijacked by Morfeus F***ing Scanner, which I was not aware was even a thing until this happened. It's activity showed up in the server access logs. I basically had to reset the entire server. It was quite a chore.

What is the best way to debug a VCL file?

I am writing inline C in my VCL file. More specifically I am using Maxmind's GeoIP database to geocode a visitor's IP. I have everything installed, I have followed all the wiki examples for GeoIP database and everything works swimmingly.
I am trying to now do some magic with GeoIP besides the return country examples. I want to return the visitor's city using the method GeoIP_record_by_addr(), which returns a pointer.
Problem: I cannot seem to correctly cast a GeoIPRecord* to char*. I have tried for hours. I get Varnish to compile my VCL file without any errors or notices, but the varnish server responds with 403.
Question: Anyway I can debug either the inline C or the 403 varnish is responding with?
Generally, Firebug and varnishlog will be your best friends.
If you want to debug pure VCL, the best way is to send data into HTTP headers ([req/bereq/beresp/resp].http.[header name]) and check their value into Firebug (or varnishlog if you have few requests).
If you want to debug inline C, you can also play with headers (VRT_SetHdr()) but if your C code makes varnish crash, you'll see why into /var/log/messages.
You can also check varnishlog to see if varnish crashes...but when varnish crashes, you get timeouts, not 403...
I'd have to see your VCL to understand why you get 403 but technically, it's not an "error", but a "status", meaning that your request has been processed by varnish (and, unfortunately, forbidden somewhrere).
I don't think Varnish would return 403 except if you ask him to do it. So there's a big chance the 403 status comes from your web server (backend).
Anyway, your varnish doesn't seem to crash but rather have behavior issues.

Resources