package com.petshop.backend.config;

import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.stereotype.Component;

@Component
public class TomcatPathToleranceConfig implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {

    @Override
    public void customize(TomcatServletWebServerFactory factory) {
        factory.addConnectorCustomizers(connector -> {
            connector.setAllowBackslash(true);
            connector.setEncodedReverseSolidusHandling("decode");
            connector.setProperty("relaxedPathChars", "\\");
            connector.setProperty("relaxedQueryChars", "\\");
        });
    }
}
