Welcome! Log In Create A New Profile


Nginx reverse proxy URL getting rewritten

Posted by gopikrish81 
Nginx reverse proxy URL getting rewritten
February 11, 2019 12:20PM
I am using nginx reverse proxy with ingress object to route my requests to kubernetes pod.

With the below config in place, when I place a request to http://myservices.myorg.com/jenkins

My request is going to http://myservices.myorg.com/login?from=%2F
But i want it to go to http://myservices.myorg.com/jenkins/login?from=%2F

So after I manually replaced to above correct path, all the resources like css, js are rendered with wrong path as http://myservices.myorg.com/static/beacae7e/css/simple-page.css

But it must be http://myservices.myorg.com/jenkins/static/beacae7e/css/simple-page.css

Similarly, after I logged in (I think http POST method) it is going to home page (in browser it changes from
http://myservices.myorg.com/jenkins/login to

But all the resources rendered again are with wrong path (without /jenkins) -

apiVersion: extensions/v1beta1
kind: Ingress
name: myingress
- host: myservices.myorg.com
- path: /jenkins
serviceName: jenkins
service port: 80

And below is nginx.conf -

http {
server {
listen 80;
server_name ip-10-118-6-35.ec2.internal;
location /jenkins {
proxy_pass https://backend_nodes_jenkins/;
upstream backend_nodes_jenkins {

As you can see in above nginx.conf , in proxy_pass I am having slash at the end of the URL since I should not pass /jenkins to my pod.

So this is working as expected but only issue is get requests are rewriting my url I believe. Please help.
Re: Nginx reverse proxy URL getting rewritten
February 11, 2019 12:51PM
Kindly delete this question from here and please move it to nginx related forum- how to category. Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready