I want to redirect requests to our internal repository servers without edit repository addresses in package manager's configuration. Here is the scenario:
Add internal IP (NGINX Server) address to hosts file as "ubuntu.com" or any other domain in each server.
Reverse proxy http or https requests which wants reach "ubuntu.com" or other domains to repository server address with different port as http request.
Would you please comment some samples for this scenario?
I can do reverse proxy, but I need some samples to rewrite URL if needed and replace domain with repository server address.
Related
I'm looking for a way to "pipe" the clients real IP address and port from Cloudflare over NGINX Proxy Manager to the main webserver apache.
The system is implemented in docker. The domain is configurated by cloudflare with proxy. I got a docker container with nginx that pipe the users requests to the apache container.
I want to log the original, real IP addresses AND the ports of users. I don't care where I pick up the data, whether it's from NGINX or Apache or, if necessary, from cloudflare. Preferably with the apache.
In PHP you get with:
$_SERVER['REMOTE_ADDR'] -> the IP address of the NGINX container (sure)
$_SERVER['HTTP_CF_CONNECTING_IP'] -> the real IP address of the user (what I want)
I don't know whether the original port is behind $_SERVER['REMOTE_PORT']. Probably not.
With Cloudflare there is the possibility to define additional fields in which the port could be passed through. How do I get to the field / the port.
Thanks a lot and best greetings
Mtz
A wasy to pipe the users original IP addresses and ports through Cloudflare and NGINX to apache (to log them).
Is it possible to configure a vhost on httpd that accepts any domain received and proxies to the actual website? Like subdomain wildcard but for the domain.
I'm assuming that tools like Squid Proxy can do this just fine, I'm just curious if it can be done with apache.
Sure that is possible, but you don't even need a proxy for that. The apache http server offers the concept of a "default virtual host". Which is exactly what you want: that host is responsible to respond to incoming requests to http hosts that do not have a specific configuration.
The default typically simply is the first of all hosts defined inside an apache http server.
An alternative I personally use is to setup the virtual hosts by just a basic configuration (name, admin and the like), but to include the actual content configuration (DocumentRoot and rewriting stuff) from a separate file). That way you can easily share the same setup between many virtual hosts but still have individual configuration options per domain, subdomain, http host, however you want to call that (there is no difference for the http server anyway, it is all http hosts).
I have a question about managing subdomains and how to best configure DNS in an architecture where the subdomains are dispatched on several servers
I don't even know if it's possible so requests for clarification
DNS configuration :
* A 51.51.51.1
# A 51.51.51.1
Domain: example.com
Sub-domain : sub1.example.com
There are 2 servers: 51.51.51.1, 51.51.51.2
How can we configure Apache on the 51.51.51.1 server so that a request like http://sub1.example.com is redirected to the 51.51.51.2 server, of course keeping the same source URL in the browser ?
Do we have to add a registration in the DNS for the sub-domain sub1 or can we do without and only modify the Apache configuration on the server 51.51.51.1 ?
Which is more effective ?
My setup is as follows:
client -> proxy(dnsname eg. https://test.com) -> Jetty webapp(1.2.3.4)
The webapp sends a redirect response back (to an authentication webapp) to the client. It automatically points to the proxy via dnsname eg. https://proxy/auth and cannot be configured further.
The issue with this is the webapp will pass redirects back to the client and the client cannot resolve https://proxy as I can't make it a dns entry. Is it then possible for the proxy to intercept the traffic from the webapp (https://proxy) and change it to https://test.com? Even better can the proxy autodetect the entry dns name and append it to any responses from the webapp?
I'd envisioned the following:
client request https://test.com/page1-> hits proxy which resolves to webapp -> webapp gives redirect response via https://proxy/auth -> proxy intercepts and changes redirect to https://test.com/auth
I need this so that everything behind the proxy isn't machine nor ip specific. I can shift and deploy to any environment.
I figured this out eventually. You can just modify the redirect headers in the location field.
Header edit Location "(^http[s]?://proxy)" "https://whatevernameyouwant"
I'm setting up a redirect server where users can input an alternate domain name, point DNS to my server, and configure it to redirect to their servers. My plan is to use the default virtual host in Apache to handle all the requests, route everything to a web application that looks up the place to redirect in a database.
I'd like to support HTTPS, but I can't figure a way to dynamically specify the certificate and key for each site. The only way that I know of configuring HTTPS is by putting directives for SSH certs and keys into a virtual host specific to that domain name. I'd like to store the certificates and keys in the database along with the domain name and have Apache call my web app during the SNI handshake.
Is it possible to have flexible, dynamic SNI under Apache?