Forum: NGINX rewrite and proxy_pass at the same time in nginx

2974d09ac2541e892966b762aad84943?d=identicon&s=25 marianopeck (Guest)
on 2013-11-18 21:55
(Received via mailing list)
HI guys. I am trying to make something to work in nginx but I have no
I posted in StackOverflow, and no answer.
I wish any of you can help me. I paste the SO question here as well:

I am using nginx and I need a proxy to redirect some service. From my
application, I should be able to do a POST, for example, to this URL:
And I need to rewrite it like this: (notice that this URL is
not HTTP).

I know I can use rewrite but I don't know how to use proxy_pass also,
because the url of the proxy_pass should be what I rewrote...

Notice that I cannot know in advance what is the final url
( in this example), so I always need to get it
the URL. I could send it as parameter if that help instead of being part
the URL.

So far my server configuration looks like this:

  listen 8776;
  server_name localhost;

  access_log  /var/log/nginx/tunnel.log;
  error_log  /var/log/nginx/error.log info;

  location ~ ^/someService(/.*)$ {
      proxy_pass https://$1;



Posted at Nginx Forum:,244782,244782#msg-244782
36a8284995fa0fb82e6aa2bede32adac?d=identicon&s=25 Francis Daly (Guest)
on 2013-11-18 23:56
(Received via mailing list)
On Mon, Nov 18, 2013 at 03:55:08PM -0500, marianopeck wrote:

Hi there,


> server
> {
>   location ~ ^/someService(/.*)$ {
>       proxy_pass https://$1;
>   }
> }

What does the error log say?

What does the error log say when you change proxy_pass to have 2 slashes
and not 3?

Francis Daly
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.