@@ -334,8 +334,6 @@ RouteEntryImplBase::RouteEntryImplBase(const VirtualHostImpl& vhost,
334
334
: ""),
335
335
path_redirect_(route.redirect().path_redirect()),
336
336
path_redirect_has_query_(path_redirect_.find(' ?' ) != absl::string_view::npos),
337
- enable_preserve_query_in_path_redirects_(Runtime::runtimeFeatureEnabled(
338
- " envoy.reloadable_features.preserve_query_string_in_path_redirects" )),
339
337
https_redirect_(route.redirect().https_redirect()),
340
338
using_new_timeouts_(route.route().has_max_stream_duration()),
341
339
prefix_rewrite_redirect_(route.redirect().prefix_rewrite()),
@@ -475,7 +473,7 @@ RouteEntryImplBase::RouteEntryImplBase(const VirtualHostImpl& vhost,
475
473
regex_rewrite_redirect_substitution_ = rewrite_spec.substitution ();
476
474
}
477
475
478
- if (enable_preserve_query_in_path_redirects_ && path_redirect_has_query_ && strip_query_) {
476
+ if (path_redirect_has_query_ && strip_query_) {
479
477
ENVOY_LOG (warn,
480
478
" `strip_query` is set to true, but `path_redirect` contains query string and it will "
481
479
" not be stripped: {}" ,
@@ -759,44 +757,30 @@ std::string RouteEntryImplBase::newPath(const Http::RequestHeaderMap& headers) c
759
757
}
760
758
761
759
std::string final_path_value;
762
- if (enable_preserve_query_in_path_redirects_) {
763
- if (!path_redirect_.empty ()) {
764
- // The path_redirect query string, if any, takes precedence over the request's query string,
765
- // and it will not be stripped regardless of `strip_query`.
766
- if (path_redirect_has_query_) {
767
- final_path = path_redirect_.c_str ();
768
- } else {
769
- const absl::string_view current_path = headers.getPathValue ();
770
- const size_t path_end = current_path.find (' ?' );
771
- const bool current_path_has_query = path_end != absl::string_view::npos;
772
- if (current_path_has_query) {
773
- final_path_value = path_redirect_;
774
- final_path_value.append (current_path.data () + path_end, current_path.length () - path_end);
775
- final_path = final_path_value;
776
- } else {
777
- final_path = path_redirect_.c_str ();
778
- }
779
- }
760
+ if (!path_redirect_.empty ()) {
761
+ // The path_redirect query string, if any, takes precedence over the request's query string,
762
+ // and it will not be stripped regardless of `strip_query`.
763
+ if (path_redirect_has_query_) {
764
+ final_path = path_redirect_.c_str ();
780
765
} else {
781
- final_path = headers.getPathValue ();
782
- }
783
- if (!path_redirect_has_query_ && strip_query_) {
784
- const size_t path_end = final_path.find (' ?' );
785
- if (path_end != absl::string_view::npos) {
786
- final_path = final_path.substr (0 , path_end);
766
+ const absl::string_view current_path = headers.getPathValue ();
767
+ const size_t path_end = current_path.find (' ?' );
768
+ const bool current_path_has_query = path_end != absl::string_view::npos;
769
+ if (current_path_has_query) {
770
+ final_path_value = path_redirect_;
771
+ final_path_value.append (current_path.data () + path_end, current_path.length () - path_end);
772
+ final_path = final_path_value;
773
+ } else {
774
+ final_path = path_redirect_.c_str ();
787
775
}
788
776
}
789
777
} else {
790
- if (!path_redirect_.empty ()) {
791
- final_path = path_redirect_.c_str ();
792
- } else {
793
- final_path = headers.getPathValue ();
794
- if (strip_query_) {
795
- const size_t path_end = final_path.find (" ?" );
796
- if (path_end != absl::string_view::npos) {
797
- final_path = final_path.substr (0 , path_end);
798
- }
799
- }
778
+ final_path = headers.getPathValue ();
779
+ }
780
+ if (!path_redirect_has_query_ && strip_query_) {
781
+ const size_t path_end = final_path.find (' ?' );
782
+ if (path_end != absl::string_view::npos) {
783
+ final_path = final_path.substr (0 , path_end);
800
784
}
801
785
}
802
786
0 commit comments