azukaar / Cosmos-Server

☁️ The Most Secure and Easy Selfhosted Home Server. Take control of your data and privacy without sacrificing security and stability (Authentication, anti-DDOS, anti-bot)
https://cosmos-cloud.io
Other
2.96k stars 105 forks source link

[FEAT]: REGEX in Reverse Proxy #236

Closed Vandekieft closed 3 months ago

Vandekieft commented 3 months ago

Feature Description

Hello,

I would like to be able to support REGEX for LAN redirects.

I maybe be one of the few who still miss the days of just typing in a LAN app name and going to that site, but modern internet and web-browsing has mostly made that hard. I did a modern home solution, although I am not sure if it is even the best method.. but it works for my home. Request for this type of support in Cosmos, but I totally understand if this is a waste of time and is just closed.

Use case: Type in 'appname.fakeEXT' redirects to 'appname.mydomain'

Makes it much easier to type in apps for users with longer domains or someone who is Lazy like me. I will post my NGIX method below for an example.

My setup:

Custom DNS with DNS re-write *.pp to reverse-proxy Reverse proxy then uses the logic below to redirect to the subdomain (app-name)

{
  "id": 5,
  "created_on": "2024-03-21T06:14:02.000Z",
  "modified_on": "2024-04-02T23:52:22.000Z",
  "owner_user_id": 1,
  "domain_names": [
    "~^(?<subdomain>.+)\\\\.pp$"
  ],
  "forward_domain_name": "$subdomain.vkplex.app$request_uri",
  "preserve_path": false,
  "certificate_id": 0,
  "ssl_forced": false,
  "block_exploits": true,
  "advanced_config": "",
  "meta": {
    "letsencrypt_agree": false,
    "dns_challenge": false
  },
  "http2_support": false,
  "enabled": 1,
  "hsts_enabled": false,
  "hsts_subdomains": false,
  "forward_scheme": "$scheme",
  "forward_http_code": 301
}

So for me, when I type in s.pp I am then re-directed to my Sonarr app.

My setup: In firefox (or fork of):

I have been switching to Cosmos to make it easier on life since I already manage so much.. but I thought I would just throw this request down. I understand if this is a no-go

Thank you for your time.

azukaar commented 3 months ago

This setup would unfortunately have to many issues

Thanks for you interest, and I hope my answer is not too disappointing