how can I programmatically add new routes to the traefik - traefik

I'm wondering, if there would be possible to add new routes programmatically to the load balancer and without stopping it up, like, for example, I have a load balancer, and every time I create a new server, it automatically could add route of this server to this Load Balancer, and the same thing with remove,does it possible to implement this flow with Traefik? if not, can you suggest me some analogies that probably can if you know some

Related

how to setup prerender function as serverless to make ISR happen

i try to host my application on AWS S3 and the static file can export to the S3 folder by export command in next.js, but when it goes to ISR, I don't know how to make it happen, i don't use vercel, i want to update the static html when the revalidate option is in our code, how to write the pre-render function and host it to a seperate serverless service, is there any way to make this happen? better have a simple example here! after set the serverless service up, how to config my next.js app to make it know that it will call the service when ISR is configured?
when i set locally in the next.js app, and run it locally, the ISR is good to go, meaning i put the pre-render function together with my ISR code, this is the way next.js document want us to do, i guess, but now, i want to host my static file in aws s3, just don't know how to set the config to make it call my pre-render function, because i want the pre-render function to host in a different servie endpoint

Can I run laravel (admin dashboard) and vue (front-end) in a single domain

I have done a project which admin dashboard is done by using laravel+vus (vue (v2.6) inside laravel(v8)) and front end is done by independent vue(v3) js(getting data from laravel api).can i run this two projects in a single domain.That is frond is will load www.domain.com and admin dashboard will load www.domain.com/admin..Can I do like this.?Routing is enable in vuejs.
You can do that, but typically it is easier to host the backend on a subdomain, e.g. you'd host the backend on something like backend.domain.com and the frontend on domain.com and/or www.domain.com. You can configure a setup like this relatively easy with nginx for example, by setting up two location blocks, one pointing to your Laravel installation, the other one to your vue 3 application.
To get back to your question, you can also set it up like you wanted, e.g. in a subfolder instead of via a subdomain. You can also do that via location blocks with nginx, but then you'd have to make sure that the routes from your backend and your frontend never have any overlap, so I wouldn't recommend to go that way.

Dynamically map url suffix to port number

I am using mountebank to mock a number of REST APIs, each one is accessible through a random port. Users are able to create new mocks or remove old ones whenever they need to.
So I want to setup an apache server such that it maps the suffix of the server url to the associated port, for example: myserver.com/8000 gets automatically proxied to myserver.com:8000
I could regenerate apache config while adding a new reverse proxy, but I would need to restart the server each time and I don't think that's a good idea.
I tried using mod_proxy_express which dynamically generate a proxy map but it seems to only map servers names and not individual paths.
Is this technically possible in apache, or any other web server for that matter ?

Tomcat to Apache Proxy / URL Sub Directory in Grails

Running a Grails web app on AWS Elastic Beanstalk with an Auto Scaling Elastic Load Balancer.
We have another AWS EC2 instance running our blog, ie. blog.domain.com
Is there a way to route traffic from domain.com/blog to the blog EC2 instance? I know with Apache you can proxy pass to a Tomcat instance, but can you do it the other way around? If so would it even work with Auto Scaling?
You could configure /blog in your grails app to a controller with a method like:
class BlogController {
def index() {
redirect(url: "http://blog.domain.com")
}
}
Edit: my answer didn't cater for the question specifying it was to be proxied not redirected... So here is my ammended version:
I took an existing Java proxy servlet code provided here: http://edwardstx.net/2010/06/http-proxy-servlet/ and implemented a Grails controller here: https://github.com/AtlasOfLivingAustralia/biocache-hubs/blob/master/grails-app/controllers/au/org/ala/biocache/hubs/ProxyController.groovy (too big to paste)
Add the following to your URL mapping file:
"/blog/$path**" (controller: 'proxy'){
action = [POST:'doPost']
}
"/blog/$path**" (controller: 'proxy'){
action = [GET:'doGet']
}
I think from memory this code expects the $path to be a full URL and you might want to store the URL prefix in a field and only pass in the path portion in the links (if that makes sense). Note you won't get any of your layout, etc., being displayed, it will simply reproduce the page as it was created in the other app. You could add some caching to it with the cache plugin.
Edit 2: This code might be overkill for your requirements and you might be better writing a simple GET service and then sending it back to the client... like described here Writing a proxy in grails

Session affinity on load balancer

We have a situation, where we are talking to a set of app servers(B) directly from another application(A). Since both are within the same SAN, we are making the httpClient Call directly connecting to application servers(from A to B) . For scaling purposes, we have put a load balancer in between(httpclient requests from A to B), but we want to make the subsequent requests goto same JVM on application(B). Hence we are looking if we can configure session affinity on load balancer, if you have experiences or insight on how this problem can be solved please let me know.
The most common way is to use a cookie like JSESSIONID to guide the load balancer.
With Apache + mod_proxy_balancer for example, define it like this:
ProxyPassMatch /.* balancer://mycluster stickysession=JSESSIONID|jsessionid