HaProxy - Read routing rules from external source - configuration

I wonder if its possible for HaProxy to fetch configuration by doing "external" API-calls on startup? Scenario is if routing rules is managed/stored in other master system and HaProxy must include those. Would be nice if you were able to make API-call and put response as a *.map file or similar
Is there a way to accomplish this?
Thanks!

Related

Does code within NextJS API feature exposed to client side

It is well known that nextjs API routes provide a straightforward solution to build your API with Next.js. and that any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint instead of a page.
I have just one doubt: is the code within the pages/api exposed to the world? I mean, can I build some logic there that has some key that must be hidden or maybe some MySQL connection?
Whether or not /api is in any way exposed to the world I do not know for sure, but according to Next documentation, "they are server-side only bundles."
In general though, for any key/sql connection that you want to run, I would put that into an .env.local file on your machine, a file that gets git ignored and never uploaded, and if you are hosting on Vercel, then use their environmental variables to store sensitive information.
You'd find environmental variables under:
{Your Account}/{Project}/Settings/Environmental Variables
p.s. Also from Next.js docs, I think you'd find this bit on getStaticProps useful.

Ingress server snippet

I can't seem to find good documentation on the scripting language that goes into the Nginx Ingress server snippet. (annotation "ingress.kubernetes.io/server-snippet")
I can't find what language is used in there. I want to do some logging in there to stdout, also can I replace that with something like javascript?
Is anyone using good resources for this I can't seem to find?
The purpose of "ingress.kubernetes.io/server-snippet" is to add some custom Nginx configuration which is not added by the ingress controller by default or using other annotations.
The good starting point to learn what can be done with this annotation is the Nginx documentation.
Since you can't configure nginx with javascript it's not possible to use js there.

How can the default route be removed on cloudfoundry using the manifest.yml

I define a route for my cloudfoundry app in its manifest file:
---
...
routes:
- route: example.com
My route gets successfully created during 'cf push' but unfortunately the default route gets created as well, i.e. I have two routes and I want only the one I defined in my manifest.
Any ideas how to get rid of the default route?
I know it is possible to remove routes, but as 'cf push' is triggered via a jenkins pipeline in my case I'd like to define everything in advance in the configuration. I assume that the manifest file is the best place to do so.
Even better would be if I can move the definition of the route into a manifest-variables file, but I'm trying it in the manifest file directly at the moment to be sure that this is not the source of my issue as I don't have much experience with it yet.
Thanks and beste regards,
Yvonne
This should work, I just tried this against Pivotal Web Services, for which CAPI is always kept pretty up to date (currently API version 2.142.0) and it worked just fine, only creating the route I specified. Which version of Cloud Foundry are you using? Also, I haven't checked if there is such a configuration but maybe your Cloud Foundry instance is configured to always create a route on the default shared domain.
One of the other possibilities is to use the commands unmap-route and map-route to map and unmap the routes of a specific application.

Custom Jekyll post types to a subdomain

Without messing about with .htaccess or another Jekyll install, how would one go about having a page or custom post type route to a subdomain? For example, _portfolio would go to http://portfolio.lendmaico.com/ rather than http://lendamico.com/portfolio?
This would be handled at the DNS and web server level.
Update your DNS to make sure that http://portfolio.lendmaico.com/ resolves to your server (it may already depending on how it's setup).
In your web server config, point incoming traffic for 'portfolio.lendmaico.com' to the physical directory path. That is, if your server config is setup to point the main lendamico.com domain to .../some/path/lendamico.com, you would add a config to point portfolio.lendmaico.com to .../some/path/lendamico.com/portfolio.
Note that unless you specifically add an htaccess type rule to prevent http://lendamico.com/portfolio from showing, you would see the same thing there as http://portfolio.lendmaico.com/.

Not able to understand how to call iframe tag to download a file from trmote machine

Can some one provide me an example code to access the remote machine file using iframes
E.g.: my remote machine is having an ip of 10.127.0.0 and i have a file in C:\file1
Can i write like?
iframe src="10.127.0.0//c:/file1"
Is above tag works properly in JSP code?
This is not possible at all for security reasons.
You need to either set up the remote site to serve the desired files through the web server, so you can access them the usual way like
http://10.127.0.0/files/file1
one easy way to do that in Apache is the Alias directive.
or use a different method altogether to get hold of the files, like a network share.