Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't allow access by IP address. #8

Closed
ericc06 opened this issue Sep 20, 2021 · 7 comments
Closed

Can't allow access by IP address. #8

ericc06 opened this issue Sep 20, 2021 · 7 comments

Comments

@ericc06
Copy link

ericc06 commented Sep 20, 2021

Hi,
I can't allow access to my website while in maintenance mode with my public IP address.

Here is my artgris_maintenance.yaml:

artgris_maintenance:
enable: true
ips: ["11.22.33.44"]
response: 503

where 11.22.33.44 is my public IP address as given by https://www.whatismyip.com/
When I access my website from my PC through the Internet, all I can see is the maintenance page.

Symfony 5.2.10
Artgris MaintenanceBundle 1.1

Thank you,
Eric

@artgris artgris added the bug label Sep 20, 2021
@artgris
Copy link
Owner

artgris commented Sep 20, 2021

Hi @ericc06,

try to clear the prod cache on your online server.

@ericc06
Copy link
Author

ericc06 commented Sep 20, 2021

Sorry, I forgot to say that I cleared the cache and that my website is in the prod environment.

@artgris
Copy link
Owner

artgris commented Sep 20, 2021

try to catch $_SERVER['REMOTE_ADDR'] on your server and compare with your ips conf.

Are you on an online server with APP_ENV=prod ?

@ericc06
Copy link
Author

ericc06 commented Sep 21, 2021

Yes, my website is online and configured with APP_ENV=prod.

But the $_SERVER['REMOTE_ADDR'] variable does not contain my public IP address, but a private one (172.16.2.1).
I have to understand why.
The website is hosted on Azure. I'm going to read their documentation...

On the other hand, if in the Twig template I display the app.request object, I can see my public IP address:
X-CLIENT-IP: 88.160.x.y
X-CLIENT-PORT: 24989
X-FORWARDED-FOR: 88.160.x.y:24989

@ericc06
Copy link
Author

ericc06 commented Sep 21, 2021

Due to Azure (like many other providers) architecture, with load balancers and other network equipments in front of the web server, we can't get the remote IP address with $_SERVER['REMOTE_ADDR'].

Do you have an idea to make the bundle work in this case?

@artgris
Copy link
Owner

artgris commented Sep 22, 2021

Hi, yes i need to test HTTP_X_FORWARDED_FOR or used $request->getClientIp().

@ericc06
Copy link
Author

ericc06 commented Oct 1, 2021

I'm sorry, the issue is not fixed in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants