We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have MapProxy running behind Apache and my own proxy written in node.
app.use('/', createProxyMiddleware({ changeOrigin: true, secure: false, router: (req) => { let novo = new URL(req.url.replace(/^\//, '')); return novo.origin; }, pathRewrite: (path, req) => { let novo = new URL(path.replace(/^\//, '')); let res = novo.pathname + novo.search; return res; }, }));
The proxy adds the header 'x-forwarded-proto': 'https' to the request, which should be ok.
'x-forwarded-proto': 'https'
Width such 'x-forwarded-proto': 'https' header, the Capabilities gets the URL malformed, as we can see in the example.
<ows:HTTP> <ows:Get xlink:href="https, https://xxx.ambiente.azores.gov.pt/mapproxy/service?"> <ows:Constraint name="GetEncoding"> <ows:AllowedValues> <ows:Value>KVP</ows:Value> </ows:AllowedValues> </ows:Constraint> </ows:Get> </ows:HTTP>
Since I control the proxy, the work around is to remove the header from the request.
app.use('/', createProxyMiddleware({ changeOrigin: true, secure: false, router: (req) => { let novo = new URL(req.url.replace(/^\//, '')); return novo.origin; }, pathRewrite: (path, req) => { delete req.headers['x-forwarded-proto']; let novo = new URL(path.replace(/^\//, '')); let res = novo.pathname + novo.search; return res; }, }));
The header should only determine with the usage of http or https, but it changes completely the URL.
9|proxy | { 9|proxy | host: 'xxx.ambiente.azores.gov.pt', 9|proxy | 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0', 9|proxy | accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 9|proxy | 'accept-language': 'pt,pt-BR;q=0.8,en-US;q=0.5,en;q=0.3', 9|proxy | 'accept-encoding': 'gzip, deflate, br', 9|proxy | cookie: '...', 9|proxy | 'upgrade-insecure-requests': '1', 9|proxy | 'sec-fetch-dest': 'document', 9|proxy | 'sec-fetch-mode': 'navigate', 9|proxy | 'sec-fetch-site': 'none', 9|proxy | 'sec-fetch-user': '?1', 9|proxy | 'sec-gpc': '1', 9|proxy | pragma: 'no-cache', 9|proxy | 'cache-control': 'no-cache', 9|proxy | 'x-forwarded-for': '94.61.164.170', 9|proxy | 'x-forwarded-proto': 'https', 9|proxy | connection: 'Keep-Alive' 9|proxy | }
The text was updated successfully, but these errors were encountered:
If 'X-Forwarded-Proto': '' the URL generated is <ows:Get xlink:href=", https://xxx.ambiente.azores.gov.pt/mapproxy/service?">.
'X-Forwarded-Proto': ''
<ows:Get xlink:href=", https://xxx.ambiente.azores.gov.pt/mapproxy/service?">
The value of X-Forwarded-Proto should be tested to make sure it is httpor https only, according to the documentation.
X-Forwarded-Proto
http
https
Sorry, something went wrong.
No branches or pull requests
Context
I have MapProxy running behind Apache and my own proxy written in node.
The proxy adds the header
'x-forwarded-proto': 'https'
to the request, which should be ok.Actual Behavior
Width such
'x-forwarded-proto': 'https'
header, the Capabilities gets the URL malformed, as we can see in the example.Possible Fix
Since I control the proxy, the work around is to remove the header from the request.
The header should only determine with the usage of http or https, but it changes completely the URL.
Other headers sent
Your Environment
The text was updated successfully, but these errors were encountered: