Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] swag auto proxy replacing all server_name entries on openvscode-server.subdomain.conf #619

Closed
1 task done
jesuzon opened this issue Oct 30, 2023 · 4 comments
Closed
1 task done

Comments

@jesuzon
Copy link

jesuzon commented Oct 30, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using the swag auto proxy mod with a label for a custom url (in my case, I have set swag_url to code.) the mod uses the template in the title correctly, but changes all the entries of server_name to whatever swag_url is (code.).

This would be fine for any other container, but in the case of openvscode-server, this leads to the loss of the clever way to capture ports as subdomains and expose them as per the template.

I have it working right now by modifying the conf created by the auto proxy mod and re-adding the regex string to capture the ports but with my desired url: "~^(?<upstream_port>[0-9]{1,10}).code..*$";

I'm not sure if this is an issue with the auto proxy mod or if something can be done on the template side to fix this behavior

Expected Behavior

Ideally, the conf created by the auto proxy mod has 3 server blocks - 1 with the base url as set by swag_url, and the next 2 containing regex strings that have this swag_url within rather than the hard-coded .openvscode-server name

Steps To Reproduce

deploy docker container using the swag auto proxy mod and setting the swag_url to a custom value will lead to this issue.

@Roxedus
Copy link
Member

Roxedus commented Oct 30, 2023

Its a bug with neither, set your swag url to the regex-stanza linuxserver/docker-mods#769

@Roxedus Roxedus closed this as completed Oct 30, 2023
@LinuxServer-CI LinuxServer-CI moved this from Non-Docker Issues to Done in Issue & PR Tracker Oct 30, 2023
@jesuzon
Copy link
Author

jesuzon commented Oct 30, 2023

Its a bug with neither, set your swag url to the regex-stanza linuxserver/docker-mods#769

sorry for re-opening, but, the code-server and the openvscode-server templates aren't the same. In the openvscode-server there are 3 server blocks - one that handles the base url, and the other 2 to handle PORT as http and PORTs for https. All 3 are replaced by whatever swag_url is set to. Changing the swag_url to the regex string as suggested doesn't work as the 3 server blocks just conflict one another. It also would lead to an issue in differentiating http and https given one can only set swag_url once.

I think the reason for the 3 server blocks in the openvscode-server config is that openvscode-server doesn't have a proxy_domain configuration option like code-server does, but I'm not sure if this is really the case.

@aptalca
Copy link
Member

aptalca commented Oct 30, 2023

That's correct. Openvscode-server conf has a very unique server block for proxying internal ports and differentiating between http and https (code-server internally does the first part but not the second).

That behavior is not compatible with auto-proxy at the moment and I was not able to come up with a quick fix. Any fix I could think of required too much effort and would add too many complications. Since it's the only conf with such an issue, I decided to leave it as is.

If you use auto proxy and set the server name, both the http and https proxy server blocks will have the same server name, which will break https proxy, but http proxy should still work as nginx should match the first one listed. Is that not the case?

@jesuzon
Copy link
Author

jesuzon commented Oct 31, 2023

That's correct. Openvscode-server conf has a very unique server block for proxying internal ports and differentiating between http and https (code-server internally does the first part but not the second).

That behavior is not compatible with auto-proxy at the moment and I was not able to come up with a quick fix. Any fix I could think of required too much effort and would add too many complications. Since it's the only conf with such an issue, I decided to leave it as is.

If you use auto proxy and set the server name, both the http and https proxy server blocks will have the same server name, which will break https proxy, but http proxy should still work as nginx should match the first one listed. Is that not the case?

Yeah, using auto proxy a setting the server name works for the base url, you just don't get the port functionality.

I think I'll move my setup to code-server as that seems to be working fine including ports

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants