在尝试将 apache 设置为反向代理时,我发现在响应标头中获取了错误的位置(位置发送为“/”,而它应该是“backend/auth/api/token”)
我已经按如下方式设置了我的 Apache 服务器(粘贴了相关部分)。我在这里做错了什么?
ProxyPreserveHost On
ProxyPass /auth/ https://backend:8443/auth/
ProxyPass /api/ https://backend:8443/endpoint/api/
ProxyPass /legacy/api/ https://backend:8443/endpoint/legacy/api/
ProxyPassReverse /auth/ https://backend:8443/auth/
ProxyPassReverse /api/ https://backend:8443/endpoint/api/
ProxyPassReverse /endpoint/api/ https://backend:8443/endpoint/api/
ProxyPassReverse /endpoint/legacy/api/ https://backend:8443/endpoint/legacy/api/
ProxyPassReverse /legacy/api https://backend:8443/endpoint/legacy/api
RequestHeader set Host frontend
ProxyPassReverseCookieDomain backend frontend
ProxyPassReverseCookiePath https://frontend:8443 https://backend:8443
RequestHeader set X-Forwarded-Proto: "https"
Header always edit Set-Cookie "(?i)^((?:(?!;\s?HttpOnly).)+)$" "$1; HttpOnly"
Header always edit Set-Cookie "(?i)^((?:(?!;\s?secure).)+)$" "$1; secure"
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "Authorization"
Header always set Access-Control-Allow-Methods "GET"
Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"
Header always set Access-Control-Max-Age "600"
Header always set Strict-Transport-Security "max-age=63072000;"
Header set X-Content-Type-Options "nosniff"
Header always append X-Frame-Options "SAMEORIGIN"
我在 CentOS 上。
答案1
这可能是您的端点本身的问题。请尝试检查后端服务器配置以及该端点的逻辑。