Skip to content

RewriteLocationResponseHeader via app-yaml as per documentation does not work #3729

Open
@kontza

Description

@kontza

Describe the bug
I'm trying to add RewriteLocationResponseHeader filter to my application.yml route definition. I'm using the format given in the documentation:

filters:
  - RewriteLocationResponseHeader=AS_IN_REQUEST, Location, ,

However, the app startup fails with:

Caused by: java.lang.IllegalArgumentException: 
  Unable to find operation interface org.springframework.web.servlet.function.HandlerFilterFunction for 
  rewriteLocationResponseHeader with args {_genkey_0=AS_IN_REQUEST, _genkey_1=Location}

I cannot, for the life of me, figure out how to tell it to use default values for the last two parameters. I've tried:

  • RewriteLocationResponseHeader=AS_IN_REQUEST, Location, '', '': this ended up creating a string containing ''.
  • RewriteLocationResponseHeader=AS_IN_REQUEST, Location, "", "": this ended up creating a string containing "".
  • RewriteLocationResponseHeader=AS_IN_REQUEST, Location, {}, {}: this ended up creating a string containing {}.

It seems as the code handling the extraction of parameters to the filter does not correctly handle empty strings. Or something along those lines.

The question is: How am I supposed to specify empty strings in app yaml to RewriteLocationResponseHeader?

Sample
I've forked the excellent demo by eyal33 which can be used to demo it. You don't need to setup any Docker stuff, just try to run the app, and the RewriteLocationResponseHeader line will take care of application startup failing.

The sample application: https://github.com/kontza/spring-cloud-gateway-mvc-demo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions