osstech-jp / nginx-mod-am

OpenAM Policy Agent for NGINX
16 stars 11 forks source link

Url rewriting #5

Open rthewhite opened 8 years ago

rthewhite commented 8 years ago

Hi, First of all, thanks for your work on this policy agent!

I'm currently compiling Nginx from source including your policy agent and all seems to be working fine. But i'm running into issues as soon as i try to rewrite an url to my upstream proxy.

I'm using Nginx as a reverse proxy and hit it with an url like:

https://example.com/auth/v1/someservice

When i proxy pass that directly to an upstream everything works fine and when i'm nog logged in i get redirected to the login page. But when i do a location rewrite:

rewrite ^/auth/v1/(.*) /$1 break;

Basically removing the 'auth/v1' part, the url is not being enforced anymore by OpenAM and i can also reach it when i'm not authenticated? Am i doing something wrong, is this expected behavior or is this a bug?

Thanks!

hamano commented 8 years ago

Sorry, I'm not using rewrite. I have no answer whether we should apply either of the URL: before or after rewrite url. Do you have any idea? How about apache?