I have the following reverse proxy in Nginx. I am trying to hide the sig key.
location /documents {
set $delimeter "";
if ($is_args) {
set $delimeter "&";
}
set $args "$args${delimeter}sp=rl&st=2024-02-15T14:18:59Z&se=2025-02-15T22:18:59Z&spr=https&sv=2022-11-02&sr=c&sig=TxTaaaaaaaaaaaaaaaaaaaaaaaaaaNgU%3D";
proxy_pass https://testtestsitweu.blob.core.windows.net/publicfiles/MyFiles/;
proxy_ssl_name testtestsitweu.blob.core.windows.net;
proxy_ssl_server_name on;
}
But when I try to access it trough http://localhost:4200/documents/file.pdf
I get the following error:
<?xml version="1.0" encoding="utf-8"?><Error><Code>BlobNotFound</Code><Message>The specified blob does not exist.
RequestId:8f693c6f-c01e-0000-65c7-647dca000000
Time:2024-02-21T13:11:22.3869564Z</Message></Error>
Normally I can access the file from https://testtestsitweu.blob.core.windows.net/publicfiles/MyFiles/file.pdf?sp=rl&st=2024-02-15T14:18:59Z&se=2025-02-15T22:18:59Z&spr=https&sv=2022-11-02&sr=c&sig=TxTaaaaaaaaaaaaaaaaaaaaaaaaaaNgU%3D
What I am doing wrong here?
2
Answers
Remove the "/" character from the end of the line where proxy_pass is located.
try this code instead,
this may be because of how Nginx handles URL encoding. In your configuration, when you set the $args variable, the & character needs to be URL-encoded as %26 to ensure it’s properly interpreted as part of the query string. otherwise, it may be interpreted as a separator within the configuration.