janoside / btc-rpc-explorer

Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
https://bitcoinexplorer.org
MIT License
1.52k stars 1.13k forks source link

"Hide this note" leads to undefined #381

Closed jsarenik closed 2 years ago

jsarenik commented 2 years ago

Describe the bug

I open a freshly installed btc-rpc-explorer at https://ex-orig.bublina.eu.org, click the X ("Hide this note") of the top-most paragraph saying "Bitcoin Explorer: The free, open-source …" and I get forwarded to https://ex-orig.bublina.eu.org/undefined. Next time I go back to https://ex-orig.bublina.eu.org/ the top-most paragraph is already not there.

Environment (please complete the following information):

Configuration file content

Please include the content from the following files. BE SURE TO MODIFY YOUR CREDENTIALS BEFORE SUBMITTING!!!

[main] bind=0.0.0.0 whitelist=192.168.1.0/24 mempoolexpiry=960 maxmempool=1000 maxorphantx=500000 rpcauth=generated_and_works # not used by btc-rpc-explorer rpcbind=127.0.0.1 rpcbind=::1 rpcbind=192.168.1.118 rpcallowip=192.168.1.0/24 txindex=1 coinstatsindex=1


 - Your btc-rpc-explorer environment configuration (either `$WORKING_DIR/.env` or `~/.config/btc-rpc-explorer.env`)

BTCEXP_ADDRESS_API=electrum BTCEXP_ELECTRUM_SERVERS=tls://blockstream.info:700 BTCEXP_PRIVACY_MODE=true BTCEXP_NO_RATES=true


**To Reproduce**

Steps to reproduce the behavior:
1. Go to https://ex-orig.bublina.eu.org/ in an incognito window of a browser.
2. Click on 'X' in top-right of the top-most paragraph.
3. See the error.
4. Open https://ex-orig.bublina.eu.org/ again to see the paragraph is not showing now.

**Screenshots or Log Output**

If applicable, add screenshots or log output to help explain your problem.

btcexp:error 404 NotFound: path=/undefined, ip=78.98.0.220, userAgent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 (crawler=false) +2m btcexp:error Error NotFound: Error: Not Found: /undefined, json: {"status":404}, userData: [object Object] (json: {"path":"/undefined","errorMsg":"Not Found: /undefined"}) +2m

**Additional context**

The BitcoinExplorer is running behind a Caddy2 HTTP server with following snippet in the config:

(basic) { encode zstd gzip header { Strict-Transport-Security "max-age=31536000; preload" X-XSS-Protection "1; mode=block" X-Frame-Options "SAMEORIGIN" X-Content-Type-Options "nosniff" Referrer-Policy no-referrer } }

ex-orig.bublina.eu.org { reverse_proxy * http://127.0.0.1:3002 import basic }



UPDATE: All URLs changed to `ex-orig`, because the `ex.bublina.eu.org` issue was worked around by redirecting `/undefined`.
jsarenik commented 2 years ago

The work-around in Caddy2 configuration file currently deployed on https://ex.bublina.eu.org follows:

ex.bublina.eu.org {
        reverse_proxy * http://127.0.0.1:3002
        redir /undefined / 301
        import basic
        import basicfile
}
jsarenik commented 2 years ago

It was actually my fault. For some reason, I was setting a header

Referrer-Policy no-referrer 

After this header was removed from https://ex.bublina.eu.org everything works fine (and reading the sources helped! :)