New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server: relative URLs are not converted to absolute URLs #51626
Comments
If you want to check correctness of work this project without SSR: From first terminal: ng run test-universal-issue:server
node dist/test-universal-issue/server/main.js From second terminal: yarn start Then go to the browser with http://localhost:4200/heroes |
Where did I say that? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Its still happening in universal@12. |
Following the investigation of @alexjavier15 I was able to solve the problem by setting the
@CaerusKaru Absolute urls work, but apparently that parameter is not set in any @nguniversal package and relative urls are not converted by default, as is claimed in the documentation. |
@robisim74 that workaround works perfectly but I think it should be enabled by default in universal engine. |
So happy I found this thread also, I thought it was wierd that we still many years after release had to server side intercept urls. https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server Clearly states
These docs have to be updated. @robisim74 fixes this for us |
+1 to @peturh comment above. Also want to point out that the docs go on to say that we can pass the full request url to
The boilerplate example only exports |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This fix no longer seems to work in Angular 17, which no longer bootstraps with an
|
Prior to this commit relative HTTP requests were not being resolved to absolute even thought the behaviour is documented in https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server. This caused relative HTTP requests to fail when done on the server because of missing request context. This change is also required to eventually support HTTP requests handled during prerendering (SSG). Closes angular#51626
Prior to this commit relative HTTP requests were not being resolved to absolute even thought the behaviour is documented in https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server. This caused relative HTTP requests to fail when done on the server because of missing request context. This change is also required to eventually support HTTP requests handled during prerendering (SSG). Closes angular#51626
Prior to this commit relative HTTP requests were not being resolved to absolute even thought the behaviour is documented in https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server. This caused relative HTTP requests to fail when done on the server because of missing request context. This change is also required to eventually support HTTP requests handled during prerendering (SSG). Closes #51626 PR Close #52326
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Prior to this commit relative HTTP requests were not being resolved to absolute even thought the behaviour is documented in https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server. This caused relative HTTP requests to fail when done on the server because of missing request context. This change is also required to eventually support HTTP requests handled during prerendering (SSG). Closes angular#51626 PR Close angular#52326
Prior to this commit relative HTTP requests were not being resolved to absolute even thought the behaviour is documented in https://angular.io/guide/universal#using-absolute-urls-for-http-data-requests-on-the-server. This caused relative HTTP requests to fail when done on the server because of missing request context. This change is also required to eventually support HTTP requests handled during prerendering (SSG). Closes angular#51626 PR Close angular#52326
🐞 Bug report
What modules are related to this issue?
Description
Actually, this is a copy angular/universal#1669 and angular/universal#1747, but since they locked, I created this issue. Please do not close this issue for the third time. Let's wait until it is really fixed.
According to the documentation,
@nguniversal/express-engine
should take care of converting relative URLs to absolute ones. In this example need converting/api/heroes
tohttp://localhost:4000/api/heroes
, but it doesn't seem to be happening.🔬 Minimal Reproduction
From first terminal:
git clone git@github.com:KostyaTretyak/example-universal-issue.git cd example-universal-issue yarn yarn dev:ssr
See which port the previous command started on, suppose this is port 4200, and from second terminal:
🔥 Exception or Error
Error trace
🌍 Your Environment
The text was updated successfully, but these errors were encountered: