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

Incorrect spelling for referer header in MapPrinterServlet.java #3197

Closed
dispiste opened this issue Feb 13, 2024 · 0 comments
Closed

Incorrect spelling for referer header in MapPrinterServlet.java #3197

dispiste opened this issue Feb 13, 2024 · 0 comments

Comments

@dispiste
Copy link
Contributor

Context

  • MapFish print version: current master code. According to commit history, it should fail from 3.23 and later
  • Java version: openjdk 11.0.16 2022-07-19
  • OS: Linux Debian 11

I will send a pull request.

Describe the bug

The referer header is incorrectly spelled in file core/src/main/java/org/mapfish/print/servlet/MapPrinterServlet.java
The correct English word is Referrer, but the HTTP header is spelled "Referer" (or "referer", since they are case insensitive).

This used to work correctly in Mapfish print, but commit 9a50a72 introduced a massive spelling correction in Mapfish and broke the spelling of the Header ( see 9a50a72 ).

Therefore, the allowedReferers configuration yaml tag fails, since the wrong header is checked.

How to reproduce

Create a template including a referer header check, for instance:

allowedReferers:
   - !hostnameMatch
     host:test.camptocamp.com
     allowSubDomains: true

Then try to get the capabilities file:
https://test.camptocamp.com/print/print/a4_landscape/capabilities.json

A HTTP 403 error will be get:

Error while processing request:
Invalid referrer

Versions prior to 3.23 returned the capabilities document instead.

Actual results

A HTTP 403 error will be get:

Error while processing request:
Invalid referrer

Expected results

Versions prior to 3.23 returned the capabilities document instead.

dispiste pushed a commit to dispiste/mapfish-print that referenced this issue Feb 13, 2024
sbrunner added a commit that referenced this issue Feb 14, 2024
Fix spelling of Referer header, fixes #3197
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant