Symfony 2.6 restrict url by host but allow a specific IP to access it

240 views Asked by At

I am trying to allow a specific IP to access a restricted path defined in security.yml with no success.

I have these 2 lines in my security.yml:

access_control:
        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY,  ip: "127.0.0.1" }
        - { path: ^/.*, role: IS_AUTHENTICATED_FULLY, host: "test.loc" }

However, I am redirected to the login page when I try to access the project on my local.

How can I achieve it?

1

There are 1 answers

0
nurikabe On

My guess is that you're running afoul of Chrome's aggressive 301 redirect caching. See a discussion here. Try in another browser such as Firefox.

The problem should go away if you clear Chrome's browsing data. You can also pop in to incognito mode to test.