Can Traefik redirect example.com/test to 192.168.1.1:8888 with no path? - traefik

Is it possible to have a domain/path redirect to internal server with no path? Ie hxxp://example.com/test redirects to an internal server 192.168.1.1:8888
I have my traefik up and running using supdomains but as soon as I try to use paths I run into issues. I've tried pathprefixstrip to no avail.
This is running in a docker on my qnap server.
[frontends.test1]
backend = "test1"
entrypoints = ["https"]
[frontends.tes1t.routes.test1]
rule = "Host:example.com;PathPrefixStrip /test"
[backends.test1]
[backends.test1.servers.test1]
url = "hxxps://192.168.1.1:8888"

Try using PathPrefixStrip:/test instead of PathPrefixStrip /test (in the same idea you used Host:example.com and not Host example.com.

Related

is it legal to use "new" as a domain extension on localhost?

In my WSL2 i use lamp and a virtual host that redirects to a laravel app. however it fails all the time to redirect to a xxx.new local url.
i use o/c the hosts file to redirect.
changing the ext' to anything else works..
is it possible to force it to work?

domain redirection with URL masking

I am using a Clould Linux server with apache webserver. I need to enable the domain forwarding from "abcexam.in" to "xyzexam.com" with URL Masking. To achive this I am using a reverse proxy in abcexam.in Virtualhost like below.
Screenshot of VirtualHost section with reverse proxy
This method is perfectly working fine only for http:// websites not working for https:// (Not working when destination URL is https:// )
Is there any changes need to done in existing setup.

Redirect Multiple Paths to external URLs

i have a problem redirecting multiple paths with traefik to multiple Destinations.
Because of software legacy reasons i have to redirect some paths behind my application to external urls.
My app is running in rancher and i'm using rancher labels to configure traefik with it:
traefik.enable: 'true'
traefik.app.backend: app
traefik.app.frontend.redirect.entryPoint: https
traefik.app.frontend.rule: 'Host: app.url'
traefik.app.protocol: http
traefik.app.port: '8080'
traefik.support.backend: support
traefik.support.protocol: https
traefik.support.frontend.redirect.regex: ^https?://app.url/support/(.*)
traefik.support.frontend.redirect.replacement: https://other.support.url
traefik.support.port: '8080'
However https://app.url/support does not redirect to https://other.support.url and i got an 404 Error.
If i had only on URL to redirct i'd add an redirect at entrypoint level of https entrypoint.
But like i suggest entrypoint doesn't support multiple redirects.
[entryPoints.https]
address = ":443"
[entryPoints.https.redirect]
regex = "^https://app.url/support"
replacement = "https://other.support.url"
How can i achieve this using latest traefik 1.6.4 and Rancher 1.6.x.
Or is it even possible ?
I don't wan't to use another proxy like nginx only for redirection that adds a lot of complications and i find the configuration with labels very comfortabel and transparent.
Any ideas anyone?
You can move the rules into frontends. Since frontends seem to need a backend defined, just define it even though it will never be called.
[backends]
[backends.fake]
[backends.fake.servers.s1]
url="http://1.2.3.4"
[frontends]
[frontends.r1]
backend = "fake"
[frontends.r1.redirect]
regex = "^http://foo.bar/(.*)"
replacement = "http://mydomain1/$1"
permanent = false
[frontends.r2]
backend = "fake"
[frontends.r2.redirect]
regex = "^http://bar.blech/(.*)"
replacement = "http://mydomain2/$1"
permanent = false

traefik - Route Path to root context host.com/mailcatcher - > container/

I'm trying to host mailcatcher in docker swarm and serve it with Traefik. I'm running mailcatcher as a service which unfortunately hosts itself on the / root context path like localhost:10980/. I have a frontend rule /mailcatcher with PathPrefixStrip so the initial load works but then the app tries to reach host.com/assets which obviously doesn't exists. Does traefik has any solution like the sub_filter option in nginx to route these requests or do I have to add these as a frontend rule to be able to host it?
Thanks in advance

Create a subdomain for my domain

I have a server of OVH company and I'm having some problems setting a subdomain for it.
My server configuration is something like this:
Apache service working at port 80 with the website and works only with https (apache config makes a redirection for http request to https).
PostgreSQL service on default port 5432
Gitlab installation working over nginx at port 81.
I'm trying to set the external_url for gitlab to http://git.example.com:81 but when I try to access, i'm being redirected to a OVH default page.
I can access gitlab if I set the external url to something like http://example.com:81 or even if I set a relative path like http://example.com:81/gitlab but I can't make it work with the subdomain http://git.example.com:81
How do you think I can get it working? Maybe I have to change DNS zone or something related to the redirections in the OVH web manager panel??
Thanks in advance! This is a really great community!
(Posted on behalf of the OP).
I just assign in the panel of the web hosting this redirection: git.example.com => example.com and that does the trick.