Change the custom public port ENV variable name to HTTP_PORT #9598
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
As described at #9559, the asset URLs are pointing to the correct host with an incorrect port name. Actually this concerns all URLs generated using the
EngineRouter
as described at #9558.This happens when Puma is running separately in a separate port which is forwarded to the public internet using an HTTP server in front which forwards all requests to a specific domain to this port on the local machine.
This causes e.g. Heroku to produce incorrect asset URLs or any other URLs created using
EngineRouter
.This fixes the issue by renaming the
PORT
ENV variable (introduced in #9403) toHTTP_PORT
which is not defined at Heroku.📌 Related Issues
Testing
RAILS_ENV=production
(and configure it accordingly):80
(see configuration example for nginx)For testing the favicon/asset URLs
:80
For testing the other URLs generated through EngineRouter
PORT=1234 RAILS_ENV=production bundle exec rails c
(make sure spring is restarted if you're using it, runspring stop
before starting the console)Decidim::ResourceLocatorPresenter.new(Decidim::Proposals::Proposal.first).url
1234
and the issue described at Notifications link doesn't work on Push Notifications #9558 no longer existsOr alternatively, find one of these routes through the UI, these should be all over, e.g. in notifications, emails, exports, etc.