Advertisement:

Author Topic: Cannot Edit Posts after moving to HTTPS  (Read 2044 times)

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Cannot Edit Posts after moving to HTTPS
« on: April 14, 2018, 02:54:50 PM »
Greetings,

A few weeks back I converted my forum to use all https with proper certificates and all that jazz.
Everything has been working so far, with the exception of editing posts. This happens on the default theme in addition to my own theme, so it's not theme related from what I can tell.

Here's the steps I take to reproduce the issue:
  • Find a post to edit
  • Click the modify button
  • The edit page loads properly in HTTPS, with the content of the post to edit
  • On the "edit" page, make edits (or not)
  • -ISSUE- When clicking save or preview, the browser will warn about submitting content over an insecure connection.
  • When the page reloads, (after clicking save or preview) it takes users back to the "edit post" page with the contents entirely missing.

I'm trying to understand the difference between making a post (which works fine) and the edit a post processes, and I'm not familiar enough. Any suggestions on where to look or start?

Thank you for the help!

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,392
  • Gender: Male
    • Kindred-999 on GitHub
Re: Cannot Edit Posts after moving to HTTPS
« Reply #1 on: April 14, 2018, 03:28:17 PM »
Best suggestion is, Upgrade to 2.0.15...
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,653
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Cannot Edit Posts after moving to HTTPS
« Reply #2 on: April 14, 2018, 03:33:04 PM »
What mods installed? You have to make sure every url starts with https:// in your smf_settings table run repair settings to check too
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Re: Cannot Edit Posts after moving to HTTPS
« Reply #3 on: April 14, 2018, 03:45:32 PM »
Best suggestion is, Upgrade to 2.0.15...
I understand that is an option; but a time consuming one. Are themes from 1.x compatible with 2.0.15?   Honestly asking, because I suspect the answer is no but that's my main hold back. :( All the modifications I've made over time also make moving quite an investment of time to get it back to the state it is now (minus editing posts).

SMF 2.1 sounds more like what I want if I'm going to spend the time upgrading... but looks like it's not ready for prime time yet?

What mods installed? You have to make sure every url starts with https:// in your smf_settings table run repair settings to check too
A handful of different ones from many years of operation. TinyPortal and Aeva media are the two largest two mods. I can provide a full list easily, but will that help?

When you say "run repair settings" is that in mysql or in SMF?

Thank you!

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,495
  • Gender: Male
    • Macedonian electronics forum
Re: Cannot Edit Posts after moving to HTTPS
« Reply #4 on: April 14, 2018, 05:02:27 PM »
Are themes from 1.x compatible with 2.0.15?

No.

But, most 2.0.x themes are compatible with 2.0.15 (you may have to edit some thing manually).

SMF 2.1 sounds more like what I want if I'm going to spend the time upgrading... but looks like it's not ready for prime time yet?

Yep, it's still in beta.

When you say "run repair settings" is that in mysql or in SMF?

You upload repair_settings.php in your forum's webspace and run repair_settings.php from the browser. You can upload it via FTP or your hosts file manager, your choice ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,110
Re: Cannot Edit Posts after moving to HTTPS
« Reply #5 on: April 14, 2018, 05:34:59 PM »

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Re: Cannot Edit Posts after moving to HTTPS
« Reply #6 on: April 26, 2018, 01:09:24 PM »
Thanks for the suggestions so far. Repair_settings did not fix the issue, and I already had all the URLs in there with https:// or /home/ per my installation.

There's THIS bit of code on the Edit Post page, which is the part causing the problem. This is the code housing the "Modify Message" window.
You'll see that it's causing the form action URL to be HTTP instead of HTTPS.

<form action="http://www.posturl.com/12345" method="post" accept-charset="UTF-8" name="postmodify" id="postmodify" onsubmit="submitonce(this);saveEntities();" enctype="multipart/form-data" style="margin: 0;">

Which PHP page do I need to examine to see how the edit page is creating the post edit url, so I can fix that? 
I am not looking to upgrade to 2.x at this time, and just need to fix this one issue.

Thank you.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,110
Re: Cannot Edit Posts after moving to HTTPS
« Reply #7 on: April 26, 2018, 01:11:25 PM »
check your .htaccess file in the root of your install.

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Re: Cannot Edit Posts after moving to HTTPS
« Reply #8 on: April 26, 2018, 01:27:36 PM »
check your .htaccess file in the root of your install.
Thank you. I have done this, as I needed to make adjustments to the file to get HTTPS working for everything else.

This is the matching code that I've found that has the same description as the problem area in my previous posts.
FROM post.template.php from the DEFAULT SMF THEME.
Code: [Select]
<form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);saveEntities();" enctype="multipart/form-data">
<table width="75%" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom" colspan="2">
', theme_linktree(), '
</td>
</tr>
</table>';
It appears that $scripturl is being passed to post.template.php without it being HTTPS. So where is this $scripturl for edited posts being generated from?
Looks like this is passed in when the function of "template_main()" is called within post.template.php, to render the post to modify.

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Re: Cannot Edit Posts after moving to HTTPS
« Reply #9 on: April 26, 2018, 01:50:28 PM »
Ah, here's more details. When viewing a thread, the following links are not displayed at HTTPS links:
  • Mark Unread
  • FOR SOME POSTS - All of the quote / modify / delete / split buttons are http. For other posts they are HTTPS (except the "quote" button is ALWAYS HTTP)

It makes no difference though between the posts with modify links being HTTP or HTTPS, when the modify page loads ALL of the Modify Post windows load the content in HTTP.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,110
Re: Cannot Edit Posts after moving to HTTPS
« Reply #10 on: April 26, 2018, 01:53:38 PM »
if you are using pretty URLs you need to modify your .htaccess file. otherwise repair_settings.php will fix this.

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Re: Cannot Edit Posts after moving to HTTPS
« Reply #11 on: April 26, 2018, 02:31:26 PM »
if you are using pretty URLs you need to modify your .htaccess file. otherwise repair_settings.php will fix this.
You've nailed it. Turning off pretty URLs fixes it all.

I am using pretty URLs, and the links that are generated with pretty URLs are the ones missing HTTPS. I am trying to edit my HTACCESS via this post:
https://www.edufinanzas.com/foro/internet-tecnologia/migrar-smf-de-http-a-https-(redirect-301-con-pretty-urls)/

NEW POST BELOW
« Last Edit: April 26, 2018, 02:47:27 PM by BLueSS »

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,110
Re: Cannot Edit Posts after moving to HTTPS
« Reply #12 on: April 26, 2018, 02:33:16 PM »
you should post in the mods support topic so that the author can assist you further.

Offline BLueSS

  • Semi-Newbie
  • *
  • Posts: 39
Re: Cannot Edit Posts after moving to HTTPS
« Reply #13 on: April 26, 2018, 02:49:11 PM »
Here's the proper fix for anyone coming into this thread from Google or search.

If using Pretty URLs you need to perform the following:
Quote
Links point to old domain after moving forum

This is very simple to fix, in addition to updating all the other settings with repair_settings.php, this mod has one more setting to fix. You can either manually fix the pretty_root_url setting yourself, or else create a new .php with this code:

<?php require_once(dirname(__FILE__) . '/SSI.php'); require_once($sourcedir . '/Subs-PrettyUrls.php'); updateSettings(array('pretty_root_url' => $boardurl)); pretty_update_filters(); ?>

Upload the file to the same location as your forum's SSI.php and open it with your web browser. Then don't forget to delete it!

via: https://code.google.com/archive/p/prettyurls/wikis/TroubleShooting.wiki

Everything is working now!