Skip to content

esbuild with proxy doesn't return Content-Language headers for OPTIONS request #26782

Closed

Description

@mivanyna

Which @angular/* package(s) are the source of the bug?

upgrade, Don't known / other

Is this a regression?

Yes

Description

I upgraded my project to Angular 17 and switched to "builder": "@angular-devkit/build-angular:browser-esbuild". For local env I use proxy config to redirect requests to test env.

I receive all the data, except for OPTIONS request there is no Content-Language header in response.
It works on prev version(Angular 16 and "builder": "@angular-devkit/build-angular:browser")

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.0.7
Node: 21.5.0 (Unsupported)
Package Manager: yarn 1.22.19
OS: win32 x64

Angular: 17.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
... upgrade

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.7
@angular-devkit/build-angular   17.0.7
@angular-devkit/architect       0.1700.7
@angular-devkit/build-angular   17.0.7
@angular-devkit/core            17.0.7
@angular-devkit/schematics      17.0.7
@schematics/angular             17.0.7
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Anything else?

I switched to "builder": "@angular-devkit/build-angular:browser-esbuild"
With proxy for the local env
package.json:

{
...
"start": "ng serve --proxy-config config/proxy.conf.js --hmr --port 3000 --open=true",
...
}

My proxy config looks like this:

const PROXY_CONFIG = [
  {
    context: [
      "/api"
    ],
    target: "test env link",
    secure: true,
    changeOrigin: true,
  }
]

module.exports = PROXY_CONFIG;

Activity

  1. changed the title [-]esbuild with proxy doesn't return Content-Language headers[/-] [+]esbuild with proxy doesn't return Content-Language headers for OPTIONS request[/+] on Jan 3, 2024
  2. transferred this issue fromangular/angularon Jan 3, 2024
  3. mivanyna commented on Jan 4, 2024

    @mivanyna
    Author

    Please let me know if you need something from me

  4. mivanyna commented on Jan 5, 2024

    @mivanyna
    Author

    This one is very critical for me as it blocks development of some parts of the app

  5. alan-agius4 commented on Jan 5, 2024

    @alan-agius4
    Collaborator

    Hi @mivanyna, to speed up our investigation kindly provide a minimal reproduction.

    A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

    That being said, it's unlikely this is a bug from our end as proxy is handled by Vite.

  6. alan-agius4 commented on Jan 5, 2024

    @alan-agius4
    Collaborator

    @mivanyna, following an offline convo with @clydin, he correctly pointed out that an OPTIONS response has no content and thus, what is the reason of having a content-language header in the first place?

  7. mivanyna commented on Jan 5, 2024

    @mivanyna
    Author

    @alan-agius4 I get localizations in the header so I can then fetch the data with GET for the locale

  8. mivanyna commented on Jan 11, 2024

    @mivanyna
    Author

    Hi there, were you able to reproduce the issue?

  9. alan-agius4 commented on Jan 11, 2024

    @alan-agius4
    Collaborator

    @mivanyna, unfortunately, I was not able yet to look into this issue. As mentioned above, it would definitely speed up the process if you share a minimal reproduction.

  10. ipranjic commented on Jan 12, 2024

    @ipranjic

    Hi @mivanyna, look at this issue: #25337
    I think you have the same problem - the array form of proxy configuration is not yet supported by Vite. Instead you should do it like this:

    module.exports = {
      "api/": { 
          target: "test env link",
          secure: true,
          changeOrigin: true
        }
     }
    
  11. mivanyna commented on Jan 12, 2024

    @mivanyna
    Author

    Hi @ipranjic , I don't think it's the case as I get all other data(GET, POST, etc)

  12. mivanyna commented on Jan 12, 2024

    @mivanyna
    Author

    @alan-agius4 here is the repo.

    What I noticed is that even if the backend server is not running I get the response for OPTIONS request, seems like the dev-server returns it.

  13. self-assigned this
    on Jan 15, 2024
  14. added
    freq1: low
    and removed
    needs: investigation
    on Jan 15, 2024
  15. alan-agius4 commented on Jan 15, 2024

    @alan-agius4
    Collaborator

    @mivanyna, I managed to find the root cause and will be opening a PR shortly.

  16. added a commit that references this issue on Jan 15, 2024
    6ebca33
  17. added 2 commits that reference this issue on Jan 16, 2024
    771fdcd
    329d800
  18. mivanyna commented on Jan 16, 2024

    @mivanyna
    Author
  19. angular-automatic-lock-bot commented on Feb 16, 2024

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  20. locked and limited conversation to collaborators on Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions