codex-storage / codex-marketplace-ui

Codex marketplace UI allowing buy and sell operations in the Codex decentralized storage network
https://app.codex.storage
Apache License 2.0
0 stars 0 forks source link

Use the announceAddresses to check the port forwarding #76

Open 2-towns opened 2 days ago

2-towns commented 2 days ago

The echo service, for some reason, is not using the ip parameter when trying to lookup the port (https://github.com/mpolden/echoip/blob/d84665c26cf7df612061e9c35abe325ba9d86b8d/http/http.go#L177C13-L177C26). But we should be able to give the IP by using the X-Forwarded-For header (https://github.com/mpolden/echoip/blob/d84665c26cf7df612061e9c35abe325ba9d86b8d/http/http.go#L93C43-L95)

2-towns commented 2 days ago

@veaceslavdoina can you add x-real-ip-custom to the ‘Access-Control-Allow-Headers’ ? I have a CORS error when trying to fetch

veaceslavdoina commented 1 day ago

Done, and we can check it

curl \
  https://echo.codex.storage/port/8070 \
  -X OPTIONS \
  -H 'X-Real-IP-Custom: 128.140.62.211' \
  -H 'Access-Control-Request-Method: GET' \
  -H 'Origin: http://localhost:3000/' \
  -v
< access-control-allow-origin: *
< access-control-allow-methods: GET, POST, OPTIONS, HEAD
< access-control-allow-headers: X-Real-IP-Custom
2-towns commented 1 day ago

Okay thanks.

Can you try it on https://releases-v0-0-13.codex-marketplace-ui.pages.dev/ ? @veaceslavdoina

veaceslavdoina commented 1 day ago

Looks like we do not get/pass a port?

This is a check on a localhost and same is with a remote node.

Image

2-towns commented 1 day ago

Oh sorry I had a proxy object intercepting the requests (for the tests). I think it is a bad idea I removed it, can you try it again ?

veaceslavdoina commented 1 day ago

Works as expected on localhost with IPv4 and remote VM with IPv6, thank you for the fix.