Apache error instead of varnish error - varnish

I configured varnish for my client .Now my client want to see apache error instead of varnish backend fetch failed in browser .Is there any option available varnish 4.

Alas, there is no option to do so.
You either pipe the requests to see everything from backend (bypassing Varnish), or you have default behaviour of 503 Backend fetch failed on errors from backend.

You can use VCL to serve the apache error page. By default Varnish, on error, will serve its preconfigured error page.
In vcl_backend_response detect if Apache is erroring, if that's the case, retunr(deliver) to serve the Apache error page.
If you share you VCL I can have a look at it.

Related

website not opening in first time shared link in browser angular 8 and nginx

bhaskarhindi.com id an angualr8 front end and Nginx server hosted in AWS instance using nodejs Redis API call to fetch data.
But after deploying and using hash the first time in the browser it is not opening showing 404 error.
But after a hard refresh or multiple time click it's opeing.
Any solution i have tried index.html aot and hashed build but not working.
404 is shown by the server itself, when it tries to find the route you have passed in the URL (as the server doesn't have access to that route, but Angular has).
You need to make sure that the server redirects all the 404 requests to the index.html of the Angular application. Only then Angular can pick up and show the pages accordingly.
Read through this: https://angular.io/guide/deployment#server-configuration for more information.

loading socket.io-client.socket.io.js fails when using ssl

I have developed a node js application which works fine as long as use http. Now I need to upgrade the code too be able to work ssl and I am having problems to load the socket.io-client/socket.io.js file. (The rest is working fine. I installed the certificates and the server works well)
Firefox fails with the following message: Blocked loading mixed active content "http://"url"/socket.io/?EIO=3&transport=polling&t=NX-uS5E". which is weird because the link states a http request.
Chrome fails with this message: socket.io.js:3511 Mixed Content: The page at 'https://"url"?' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://"url"/socket.io/?EIO=3&transport=polling&t=NX-s_OB'. This request has been blocked; the content must be served over HTTPS.
It seems that socket.io-client is trying to load a resource using http instead of https. Is that possible?
How can I correct this? Any idea?
I have been searching the web for two days noow and I have not come to any indication of someone else having this issue
Ok, after letting it go for the evening and having a good rest I checked my whole code again and found the error!
I had one obfuscated code line where I was using a http request instead of a https one. I had to correct this on both, the server and the client side.
I also had to include the port number on each of the calls and force the socket on the client side to use polling instead of websockets by adding the option "transports: ['polling']"

Request hitting varnish and getting served and not checking mod_security rule?

I have a reverse proxy server on which mod_security is configured to be used as web application firewall and varnish is for cache. I have blocked a country but as request hit Varnish and getting served. The setup is like below
Request > Varnish[80] > Mod_security/HTTPD[8080]
On opening page on 8080, the rule is working , but on 80 the request is getting served by the Varnish.
You will need to put your geolocation rules into varnish for it to get use of varnish (alternatives are really bad for cache hitrates). Theres a VMOD for geo-location called https://github.com/varnish/libvmod-geoip

Neo4j running behind proxy on IIS

What's required to setup Neo4j behind IIS proxy server?
I am running into the issue listed here: https://github.com/neo4j/neo4j/issues/112
Error message (Chrome console):
displayed insecure content from =1363713541737">http://xyz:7474/db/data/?=1363713541737
xyz is the server name.
Thanks
Considering the GitHub issue is still open, you can assume that this is not currently supported and no workaround has been supplied by Neo.
If you want to persist ahead, you will need to rewrite the content passing through the proxy.

How to test a 503 custom error page.

A rather strange question:
How can I test a custom 503 error page without restarting the service.
(Struts application on tomcat with apache front loading)
"What I really want is some how SIMULATE that the tomcat crashed, and apache as the front end will grab the error page, and redirect to the custom error page"
You could create a Servlet which you exclude from production builds. This Servlet examines a parameter (e.g. errorCode) and sets it using the HTTP Servlet Response object: javax/servlet/http/HttpServletResponse.html#sendError(int, java.lang.String).
Then you are able to test all kinds of error codes, e.g.:
http://myapp.com/webapp/errorServlet?503
Not nice, but should work... if you want to unit test your Apache Web Server only you could create a separate WAR file (depends on your test scope).
Have you tried to use curl?
curl -H http://your/path/to/503page

Resources