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

Fix proxy_base_url #16

Open
david7378 opened this issue May 16, 2024 · 7 comments
Open

Fix proxy_base_url #16

david7378 opened this issue May 16, 2024 · 7 comments
Assignees
Labels
DevOps This label marks this as a DevOps activity

Comments

@david7378
Copy link
Contributor

The Geoserver chart comes with the value

geoserver_proxy_base_url: "${X-Forwarded-Proto}://${X-Forwarded-Host}/geoserver"

but it does not work when attempting to log in to Geoserver.

Image after trying login attempt
image

@david7378 david7378 added the DevOps This label marks this as a DevOps activity label May 16, 2024
@david7378 david7378 self-assigned this May 16, 2024
@david7378
Copy link
Contributor Author

Changing the value to

 geoserver_proxy_base_url: "http://localhost:8080/geoserver" 

it enables successful login.
Thanks to Camuffo, I discovered that if we check the "use headers for Proxy Url" in global settings, and then replace geoserver_proxy_base_url with

${X-Forwarded-Proto}://${X-Forwarded-Host}/geoserver

After upgrading the helm deployment, it functions correctly.
Currently, I have been searching for a flag to activate the mentioned checkbox in order to avoid the above process, but no found anything yet.
Perhaps you @randomorder have some hints about it?

@randomorder
Copy link
Member

Hi @david7378
The checkbox to enable the use of headers in the global settings is mapped to the global.xml file in the geoserver datadir. If the geoserver is started on an empty data directory the global.xml is generated on the fly with the checkbox unchecked.

For the PBU to work with headers we need to have a sample datadir in geoserver with that checkbox checked

@david7378
Copy link
Contributor Author

I made some progress, I managed to configure it from the Rancher UI and pass the global.xml file as a ConfigMap with the parameter useHeadersProxyURL set to true and it works.
I am going to update the chart with this config.

image

@david7378
Copy link
Contributor Author

Hi @randomorder
I have created a PR for charts repository.
This is the link of the PR:
Link to PR

@randomorder
Copy link
Member

Problem is that the Chart spin up a geoserver or geoserver cluster with a default datadir. In the default datadir the checkbox to use headers for PBU is not checked so the dynamic PBU cannot really work.

In my opinion we should add a flag to enable/disable the proxy base URL in the values file similarly to what we are doing with the CSRF here . The flag should be disabled by default.

@randomorder
Copy link
Member

Problem is that the Chart spin up a geoserver or geoserver cluster with a default datadir. In the default datadir the checkbox to use headers for PBU is not checked so the dynamic PBU cannot really work.

In my opinion we should add a flag to enable/disable the proxy base URL in the values file similarly to what we are doing with the CSRF here . The flag should be disabled by default.

What do you think @camuffo ?

@camuffo
Copy link
Contributor

camuffo commented Jun 20, 2024

@randomorder

add a flag to enable/disable the proxy base URL in the values

I think this is useful in the case we want to use the PBU in the data_dir.
So it's nice to have, but solves another problem. (And maybe it requires to make the assignment here conditional).

Here we are trying to achieve a deploy that uses headers in the PBU and at the same time doesn't require intervention in the GS UI.

So we can:

  • overwrite the whole global.xml, as David did. I agree it might lead to unforeseen issues though.
  • patch the entrypoint to patch the global.xml at runtime. 🙂 Ugly.
  • ask aaime to implement an env var to enable the headers in PBU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DevOps This label marks this as a DevOps activity
Projects
None yet
Development

No branches or pull requests

3 participants