Why does nginx rewrite sending https to http?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why does nginx rewrite sending https to http?

Kevin
Hi,

I'm trying to rewrite some route in cloud foundry static buildpack, but whenever I rewrite, the https goes to http.

So I add return with / with /login, then it goes to http://server/, even it starts with https://server/login.


location /login {
      return 301 /;

      <% if ENV["FORCE_HTTPS"] %>
        if ($http_x_forwarded_proto != "https") {
          return 301 https://$host$request_uri;
        }
      <% end %>
 }



_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Why does nginx rewrite sending https to http?

Francis Daly
On Wed, Apr 26, 2017 at 12:32:27PM -0400, Kevin wrote:

Hi there,

> I'm trying to rewrite some route in cloud foundry static buildpack, but
> whenever I rewrite, the https goes to http.
>
> So I add return with / with /login, then it goes to http://server/, even it
> starts with https://server/login.

The nginx config fragment that you show, by itself will not show the
behaviour that you report.

Possibly there is some other config or relevant architecture that is
involved?

Good luck with it,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx