Skip to content

Test usage of MINIO_SERVER_URL in share functionality

Allan Roger Reid edited this page Apr 22, 2024 · 1 revision

Test usage of MINIO_SERVER_URL in share functionality

Clone and compile minio/minio master and minio/console master

mkdir -p ~/github && cd ~/github
git clone https://github.com/minio/minio.git
git clone https://github.com/minio/console.git

Install npm, then yarn

sudo apt-get install nodejs -y
sudo apt-get install npm -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm install && nvm use && npm install -g yarn

Install go

wget https://go.dev/dl/go1.21.9.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.9.linux-amd64.tar.gz
cat <<EOF >> $HOME/.profile 
export PATH=$PATH:/usr/local/go/bin:~/go/bin
EOF
cat $HOME/.profile 
source $HOME/.profile
go version

Using minio/console, run make assets

cd ~/github/console && make assets

In minio/minio go.mod, add:

replace github.com/minio/console => ../console
image

In minio/minio, run make build

A.- Run minio, without a MINIO_SERVER_URL env variable

~/github/minio/minio server /tmp/data --address :9000 --console-address :9090 --certs-dir ~/.minio/certs

Upload a file mixkit-big-wild-cat-long-purr-96.wav. Share the file.

https://allanroger.ddns.net:9090/api/v1/download-shared-object/aHR0cHM6Ly8xMjcuMC4wLjE6OTAwMC90ZXN0LW1pbmlvLXNlcnZlci11cmwvbWl4a2l0LWJpZy13aWxkLWNhdC1sb25nLXB1cnItOTYud2F2P1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9UzRXMFFYM0dRM1hCMkhOUEpHRFAlMkYyMDI0MDQyMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA0MjJUMTcyNjUyWiZYLUFtei1FeHBpcmVzPTQzMjAwJlgtQW16LVNlY3VyaXR5LVRva2VuPWV5SmhiR2NpT2lKSVV6VXhNaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpoWTJObGMzTkxaWGtpT2lKVE5GY3dVVmd6UjFFeldFSXlTRTVRU2tkRVVDSXNJbVY0Y0NJNk1UY3hNemcwT1RVd05pd2ljR0Z5Wlc1MElqb2liV2x1YVc5aFpHMXBiaUo5LktqYjk2cUhienlNRkY3ajVuaHlCeFlveXNpX0hvajVjeml5bDctVmVHX1FsSk5ZeFpuZ1kzNWVuSWcyVGxDeUNwelBsNDJhZHV4NDVQeDExY3N6SnB3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZ2ZXJzaW9uSWQ9bnVsbCZYLUFtei1TaWduYXR1cmU9NzUxMmMzODE0NWRkZmJhM2JhZWUwMDJmNDVlNTJjOWMzNTFjMjg4ZjQ0ZDMwNzVlNTkwYTFiNzI0YWFhM2MyZA==
image

Observe failure in accessing the file from a browser, or curl

➜  ~ curl https://allanroger.ddns.net:9090/api/v1/download-shared-object/aHR0cHM6Ly8xMjcuMC4wLjE6OTAwMC90ZXN0LW1pbmlvLXNlcnZlci11cmwvbWl4a2l0LWJpZy13aWxkLWNhdC1sb25nLXB1cnItOTYud2F2P1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9UzRXMFFYM0dRM1hCMkhOUEpHRFAlMkYyMDI0MDQyMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA0MjJUMTcyNjUyWiZYLUFtei1FeHBpcmVzPTQzMjAwJlgtQW16LVNlY3VyaXR5LVRva2VuPWV5SmhiR2NpT2lKSVV6VXhNaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpoWTJObGMzTkxaWGtpT2lKVE5GY3dVVmd6UjFFeldFSXlTRTVRU2tkRVVDSXNJbVY0Y0NJNk1UY3hNemcwT1RVd05pd2ljR0Z5Wlc1MElqb2liV2x1YVc5aFpHMXBiaUo5LktqYjk2cUhienlNRkY3ajVuaHlCeFlveXNpX0hvajVjeml5bDctVmVHX1FsSk5ZeFpuZ1kzNWVuSWcyVGxDeUNwelBsNDJhZHV4NDVQeDExY3N6SnB3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZ2ZXJzaW9uSWQ9bnVsbCZYLUFtei1TaWduYXR1cmU9NzUxMmMzODE0NWRkZmJhM2JhZWUwMDJmNDVlNTJjOWMzNTFjMjg4ZjQ0ZDMwNzVlNTkwYTFiNzI0YWFhM2MyZA\=\=
{"detailedMessage":"Get \"https://127.0.0.1:9000/test-minio-server-url/mixkit-big-wild-cat-long-purr-96.wav?X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=S4W0QX3GQ3XB2HNPJGDP%2F20240422%2Fus-east-1%2Fs3%2Faws4_request\u0026X-Amz-Date=20240422T172652Z\u0026X-Amz-Expires=43200\u0026X-Amz-Security-Token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJTNFcwUVgzR1EzWEIySE5QSkdEUCIsImV4cCI6MTcxMzg0OTUwNiwicGFyZW50IjoibWluaW9hZG1pbiJ9.Kjb96qHbzyMFF7j5nhyBxYoysi_Hoj5cziyl7-VeG_QlJNYxZngY35enIg2TlCyCpzPl42adux45Px11cszJpw\u0026X-Amz-SignedHeaders=host\u0026versionId=null\u0026X-Amz-Signature=7512c38145ddfba3baee002f45e52c9c351c288f44d3075e590a1b724aaa3c2d\": tls: failed to verify certificate: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs","message":"an error occurred, please try again"}%    

B.- Run minio, with a MINIO_SERVER_URL env variable

MINIO_SERVER_URL=https://allanroger.ddns.net:9000 ~/github/minio/minio server /tmp/data --address :9000 --console-address :9090 --certs-dir ~/.minio/certs

Regenerate share url. Observe success in accessing the file from a browser, or curl

image

C.- Upload a png or jpg file e.g 25410290293_f9167710fd_o.jpg. Share the file. Observe 404 error

image

Examine URL. Observe extra "/" symbol which is breaking base64 decoding.

https://allanroger.ddns.net:9090/api/v1/download-shared-object/aHR0cHM6Ly9hbGxhbnJvZ2VyLmRkbnMubmV0OjkwMDAvdGVzdC1taW5pby1zZXJ2ZXItdXJsLzI1NDEwMjkwMjkzX2Y5MTY3NzEwZmRfby5qcGc/WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1MQTAyTzRXUTZGTU9UUzI1UkZEWCUyRjIwMjQwNDIyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDQyMlQxNzMzNDlaJlgtQW16LUV4cGlyZXM9NDMyMDAmWC1BbXotU2VjdXJpdHktVG9rZW49ZXlKaGJHY2lPaUpJVXpVeE1pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SmhZMk5sYzNOTFpYa2lPaUpNUVRBeVR6UlhVVFpHVFU5VVV6STFVa1pFV0NJc0ltVjRjQ0k2TVRjeE16ZzFNREl5TXl3aWNHRnlaVzUwSWpvaWJXbHVhVzloWkcxcGJpSjkuYmw5Qks0bUxmZFNPYWZXRGowdTZaVk15Y1Z4MVE1dXZJck92MXI4OGtxUmhPVU5TV0gwcExoM2pJM3czelhGRm83QlgxOHdsejY5ZTY3ZDkwZVlpT0EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnZlcnNpb25JZD1udWxsJlgtQW16LVNpZ25hdHVyZT1mZTdjOWU1MzkzMDQ1MDczYjVkMjE5OWU5MjJiMmJkZThlZWY2YWY0MGNiY2QzMGQwZDlhMTFhNjRhODQ0ODQ3
Clone this wiki locally