Proxy not working if Browser.application is used
ad-si opened this issue · 1 comments
ad-si commented
Is this a bug report?
Yes
Environment
node -v
: v16.10.0npm -v
: 7.24.1npm ls create-elm-app -g
:
/usr/local/lib
└── create-elm-app@5.22.0
Then, specify:
- Operating system: macOS Catalina 10.15.7 19H1419 x86_64
Steps to Reproduce
- Start a JSON API server at http://localhost:8081 serving an
/items
endpoint - Add this to
elmapp.config.js
module.exports = { proxy: "http://localhost:8081", }
- Create Elm app like:
main : Program () Model Msg main = Browser.application { view = view , init = \_ -> \_ -> \_ -> init , update = update , subscriptions = always Sub.none , onUrlRequest = \_ -> NoOp , onUrlChange = \_ -> NoOp }
- Start elm app with
npx elm-app start
Expected Behavior
http://localhost:3000/items
should serve the JSON
Actual Behavior
Serves the same Elm app as under http://localhost:3000
I assume that the problem is the interaction with Browser.application
, but I'm not sure about that.
ad-si commented
So the proxy is actually working, but you can't open it in the browser! 😅
Because of the requested Content-Type
I guess?
I leave this issue open as "Improve documentation on how proxy is working exactly"