Hi I am trying to redirect url and access using backend but i struct in configuration my initial configuration is
acl url_tag18 path_beg /v1
use_backend cdn if url_tag18
backend cdn
reqrep ^([^\ ]*\ )/v1(.*) wp/\1
server web02 24.222.145.72:80 cookie A check
I am trying to convert the below url
http://example.com/v1/auth_score/ghts/hjk/klk/jkjlj.js
to http://example.com/wp/example.com/v1/auth_score/ghts/hjk/klk/jkjlj.js
Please help me to
Change reqrep in your backend to something like this:
reqirep ^([^\ :]*)\ /v1/(.*) \1\ /wp/example.com/v1/\2
I have solved my question using below code in haproxy
acl url_tag19 path_beg -i /v1
use_backend cdn if url_tag19
redirect prefix /wp/example.com if url_tag19
Related
I have a nodejs app running inside a docker container on port 3050. If I allow the port through the firewall then everything works fine. But if I try to ProxyPass it then the app seems to receive GET instead of POST.
ProxyPass / http://localhost:3050/
When I look at the access log apache receives the request as a POST. But logging the req.method in expressjs results in GET. I have also tried loads of other settings
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:3050/
ProxyPassReverse / http://localhost:3050/
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
The strangest thing is that I am Proxying lots of other services like gitlab and keycloak without any problem.
Could it be something to do with HTTP 1.1 or HTTP 2? Or does my httpd server have some setting messed up?
I was only testing with postman...obviously in future I should try curl or something as well. Turns out that postman has a setting "Redirect with the original HTTP method instead of the default behavior of redirecting with GET." which is turned off by default. I don't know whether the browser will behave like this but at least now it seems to be working
update:
Actually it wasn't even that setting. it was because i had not prefixed the url with https:// due to a training course which excluded the protocol because we weren't working with secure. so the httpd server proxied port 80 to 443 and postman didn't handle it correct. as i would be hitting directly https in production it shouldn't be a problem
how can i configure host path redirection of all sub domains to a same backed server.
For example
my domain is example.com
sub domains are *.example.com
I need to redirect *.example.com/abc/ to another backed server.
My frontend ACLs are
acl host_star hdr(host) -i *.example.com
use_backend back_live if host_star
acl is_node path_beg -i /abc/
use_backend backend_node if host_star is_node
I need to go abc.example.com/abc/ and xyz.example.com/abc/ to same backend server
I completed it by using hdr_end(host)
acl host_star hdr_end(host) -i .example.com
I am running an NGINX server pointing to my proxy server which is running on Node. I am redirecting to app/ from node using express redirect. I am also passing a custom header using res.set("X-Custom-Header","XXX"); before the redirect. But the same header is not retrieved on app/ route on NGINX. Is there anything I am missing?
By default, nginx does not pass headers containing underscores.
Try:
underscores_in_headers on;
See this document for details.
I have a node app running on http://localhost:3000. I set up ssl/https with LetsEncrypt so all requests are 301 redirected to https. Im using Nginx as web server.
I'm trying to move my URL from resume.mydomain.com to mydomain.com/resume.
How do I forward requests to mydomain.com AND mydomain.com/resume to my node app?
If users go to mydomain.com AND resume.mydomain.com they should automatically be redirected to mydomain.com/resume.
How do I do this?
To solve CORS issue, I need remove my server port and use apache to redirect to my tomcat with port.
example: http get url: localhost/app1/somerequest, my apache server will redirect to localhost:8080/app1/somerequest, so how can this redirect be work when i use nodejs?
If you want to proxy the request, use node-http-proxy.
If you want to redirect the request, see this