Jump to content

HTTP sub domain proxy

SeanFarmer

Hi guys, after a bit of help, I’m trying to get a subdomain to redirect to an internal IP address on the network
 

I’ve tried the IIS rewire all, and I’ve also tried Apache2 I seem to have no luck with it and I was wondering if anyone is experienced with it

 

https://www.iis.net/downloads/microsoft/url-rewrite

 

https://serverfault.com/questions/415780/how-to-point-sub-domains-to-different-local-ip

Link to comment
Share on other sites

Link to post
Share on other sites

Not overly familiar with IIS or Apache 2, but it sounds like you want a reverse proxy. This should easily be doable with Apache 2's virtual hosts.

https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

 

The question is: Does your DNS provider resolve subdomains to your web server's public IP? If that's not the case, you need to fix that first, before you can begin to handle the requests on the server side.

 

At work we typically do it with nginx. The basic idea is to define a virtual host that uses the subdomain as the server name it listens to, then redirects the incoming traffic to some other (internal) IP.

 

A simplified example would look like this:

server {
    listen 0.0.0.0:80;
    listen [::]:80;

    server_name subdomain.mydomain.com;
    server_tokens off; ## Don't show the nginx version number, a security best practice

    # Redirect to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 0.0.0.0:443 ssl;
    listen [::]:443 ssl;

    server_name subdomain.mydomain.com;
    server_tokens off; ## Don't show the nginx version number, a security best practice

    # <SSL configuration here>

    # Redirect
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://<YOUR-INTERNAL-IP-HERE>;
        proxy_read_timeout 300;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

 

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, Eigenvektor said:

Not overly familiar with IIS or Apache 2, but it sounds like you want a reverse proxy. This should easily be doable with Apache 2's virtual hosts.

https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

 

The question is: Does your DNS provider resolve subdomains to your web server's public IP? If that's not the case, you need to fix that first, before you can begin to handle the requests on the server side.

 

At work we typically do it with nginx. The basic idea is to define a virtual host that uses the subdomain as the server name it listens to, then redirects the incoming traffic to some other (internal) IP.

 

A simplified example would look like this:

server {
    listen 0.0.0.0:80;
    listen [::]:80;

    server_name subdomain.mydomain.com;
    server_tokens off; ## Don't show the nginx version number, a security best practice

    # Redirect to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 0.0.0.0:443 ssl;
    listen [::]:443 ssl;

    server_name subdomain.mydomain.com;
    server_tokens off; ## Don't show the nginx version number, a security best practice

    # <SSL configuration here>

    # Redirect
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://<YOUR-INTERNAL-IP-HERE>;
        proxy_read_timeout 300;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

 

"Not overly familiar with IIS or Apache 2, but it sounds like you want a reverse proxy. This should easily be doable with Apache 2's virtual hosts.

https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension"

 

I've just retried this with the same result 

do you suggest nginx

Link to comment
Share on other sites

Link to post
Share on other sites

29 minutes ago, SeanFarmer said:

"Not overly familiar with IIS or Apache 2, but it sounds like you want a reverse proxy. This should easily be doable with Apache 2's virtual hosts.

https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension"

 

I've just retried this with the same result 

do you suggest nginx

Virtual hosts are reverse proxy. Use what you are familiar with, you can do this with haproxy, nginx and apache (heck even IIS)

mY sYsTeM iS Not pErfoRmInG aS gOOd As I sAW oN yOuTuBe. WhA t IS a GoOd FaN CuRVe??!!? wHat aRe tEh GoOd OvERclok SeTTinGS FoR My CaRd??  HoW CaN I foRcE my GpU to uSe 1o0%? BuT WiLL i HaVE Bo0tllEnEcKs? RyZEN dOeS NoT peRfORm BetTer wItH HiGhER sPEED RaM!!dId i WiN teH SiLiCON LotTerrYyOu ShoUlD dEsHrOuD uR GPUmy SYstEm iS UNDerPerforMiNg iN WarzONEcan mY Pc Run WiNdOwS 11 ?woUld BaKInG MY GRaPHics card fIX it? MultimETeR TeSTiNG!! aMd'S GpU DrIvErS aRe as goOD aS NviDia's YOU SHoUlD oVERCloCk yOUR ramS To 5000C18

 

Link to comment
Share on other sites

Link to post
Share on other sites

39 minutes ago, Levent said:

Virtual hosts are reverse proxy. Use what you are familiar with, you can do this with haproxy, nginx and apache (heck even IIS)

I've tried iis and apache, all they do is redirect 

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, SeanFarmer said:

I've tried iis and apache, all they do is redirect 

I looked through my chatgpt history and this is what I used last year and still continue to do so. (I use nginx and this is my config)

 

Change subdomain.example.com and http://10.1.0.1:80 according to your setup. Your DNS has to point to this nginx server.

server {
    listen 80;
    server_name subdomain.example.com;

    location / {
        proxy_pass http://10.1.0.1:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Additional configurations if needed
    # ...

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
}

You can also use nginx proxy manager in docker, which makes this task a breeze.

mY sYsTeM iS Not pErfoRmInG aS gOOd As I sAW oN yOuTuBe. WhA t IS a GoOd FaN CuRVe??!!? wHat aRe tEh GoOd OvERclok SeTTinGS FoR My CaRd??  HoW CaN I foRcE my GpU to uSe 1o0%? BuT WiLL i HaVE Bo0tllEnEcKs? RyZEN dOeS NoT peRfORm BetTer wItH HiGhER sPEED RaM!!dId i WiN teH SiLiCON LotTerrYyOu ShoUlD dEsHrOuD uR GPUmy SYstEm iS UNDerPerforMiNg iN WarzONEcan mY Pc Run WiNdOwS 11 ?woUld BaKInG MY GRaPHics card fIX it? MultimETeR TeSTiNG!! aMd'S GpU DrIvErS aRe as goOD aS NviDia's YOU SHoUlD oVERCloCk yOUR ramS To 5000C18

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Levent said:

I looked through my chatgpt history and this is what I used last year and still continue to do so. (I use nginx and this is my config)

 

Change subdomain.example.com and http://10.1.0.1:80 according to your setup. Your DNS has to point to this nginx server.

server {
    listen 80;
    server_name subdomain.example.com;

    location / {
        proxy_pass http://10.1.0.1:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Additional configurations if needed
    # ...

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
}

You can also use nginx proxy manager in docker, which makes this task a breeze.

All done but still noting 

IMG_2092.png

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, SeanFarmer said:

All done but still noting 

 

It is working, your issue is https. Your internal application doesnt have it and nginx is hosting it on TCP443.

image.thumb.png.333c5aa3251ac64192d65fb3105c1ad1.png

 

mY sYsTeM iS Not pErfoRmInG aS gOOd As I sAW oN yOuTuBe. WhA t IS a GoOd FaN CuRVe??!!? wHat aRe tEh GoOd OvERclok SeTTinGS FoR My CaRd??  HoW CaN I foRcE my GpU to uSe 1o0%? BuT WiLL i HaVE Bo0tllEnEcKs? RyZEN dOeS NoT peRfORm BetTer wItH HiGhER sPEED RaM!!dId i WiN teH SiLiCON LotTerrYyOu ShoUlD dEsHrOuD uR GPUmy SYstEm iS UNDerPerforMiNg iN WarzONEcan mY Pc Run WiNdOwS 11 ?woUld BaKInG MY GRaPHics card fIX it? MultimETeR TeSTiNG!! aMd'S GpU DrIvErS aRe as goOD aS NviDia's YOU SHoUlD oVERCloCk yOUR ramS To 5000C18

 

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, Levent said:

It is working, your issue is https. Your internal application doesnt have it and nginx is hosting it on TCP443.

image.thumb.png.333c5aa3251ac64192d65fb3105c1ad1.png

 

Is there an easy way to disable it though the conf file?

Link to comment
Share on other sites

Link to post
Share on other sites

  • 4 weeks later...

Setting up an HTTP subdomain proxy involves routing traffic from a subdomain to a different server or service. This is frequently carried out for content distribution, security, and load balancing. While there are several ways to accomplish this, using a reverse proxy server, such as Nginx or Apache, is a popular strategy.

If you have a main domain and you want to set up the subdomain, It serves as a stand-in for a different server. Here's a simple Nginx example:

 

  • Install Nginx
  • Configure Nginx
  • Create a symbolic link
  • Test and Restart Nginx

 


 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×