mirror of
https://github.com/mmatczuk/go-http-tunnel.git
synced 2026-05-15 14:16:17 -06:00
[GH-ISSUE #84] On reload redirects to the local address #43
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/go-http-tunnel#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @applegrew on GitHub (Jul 29, 2018).
Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/84
I am facing a weird issue. My tunnel.yaml file is as below :-
On server side
-httpAddris set to:8000. When I access the site from the browsers ashttp://me.example.com:8000it works fine. However, when I reload the site I get a 302 from the site and I am redirected tohttp://127.0.0.1:8080. The actual site does not seem to issue the 302. It seems like go-http-tunnel is issuing that for some reason. If I goto some other url and come back to the same url I do not get the 302; it is only when I hit the same url twice consecutively I get the 302. If I change theaddr:to sayhttps://google.comthen I do not see this issue.@Harvey-Kaer commented on GitHub (Apr 23, 2019):
Hi applegrew,
I am facing a similar issue as redirected to localdomain of the client.
Do you manage to find a solution?
@applegrew commented on GitHub (Apr 23, 2019):
Nopes.
On Tue, 23 Apr, 2019, 10:36 PM Harvey-Kaer, notifications@github.com
wrote:
@Harvey-Kaer commented on GitHub (Apr 25, 2019):
After some search and trial, I found a solution works for me. I use nginx as proxy for go-http-tunnel and rewrite the HTTP header using
proxy_redirect.`
server {
}
`
Then run tunneld on your server with additional -httpsAddr flag (or -httpAddr if you only need HTTP):
tunneld -httpsAddr [tunneld_httpsAddr] -tlsCrt /path/to/cert -tlsKey /path/to/private_key===============================================================
References:
As of hint of OP, I looked into the packages around 302 Redirect and found the "LOCATION" header was responded as "localhost" or local domain in some packages.
https://stackoverflow.com/questions/46947548/ngrok-not-passing-my-post-request-on-to-localhost
ngrok has a
-host-header=rewriteflag so I'm looking for a similar one.Then I decided to use nginx to redirect package:
https://serverfault.com/questions/428793/using-nginxs-proxy-redirect-when-the-response-locations-domain-varies
(for the regex in
proxy_redirect, I used~^http://[^/]+(/.*)$instead of~^http://[^/]+(/.+)$so that empty path string (likehttp://localhost/) will also be redirected.